04.
Web Debug Toolbar and Profiler
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
Whoops, an error! Please, try again later.
7 Comments
Hi! I have an issue with internal redirects (http504) is there a way to track internal redirects? I know that the profiler toolbar lets me see where the current response was redirected from (if any), but according to the webhost, I exceed the limit of 10 internal redirects... I'm not doing any redirects in my code, so it must be a configuration thing. Either in my symfony setup/routing, or in the nginx setup... Is there any logg or such in symfony that can reveal this to me?
Hey Matt,
Yeah, you need to enable redirects intercepting in the profiler, see the docs about how to enable it: https://symfony.com/doc/current/reference/configuration/web_profiler.html#intercept-redirects
Other than that feature, I'm not sure there's anything that could help you to debug it. Well, you can try to
dd()somewhere in the code to actually stop at some point, but that's probably it. Just look closer at the page from which you're redirected, i.e. inspect that code for any redirects, etc. Oh, there's also a useful debug_backtrace() PHP function that might help you, but you need to find a good way where to call it in your code, though IIRC the Symfony profiler with enabled redirects intercepting will give you the same info, or even more. So, just look at the WDT closer. Or, try to google for a better way maybe, not sure if it's possible to do it on a higher level - there might be a better way I didn't know about probably.But still, even 10 redirects per 1 request sounds not quite right, so I bet you just have circular redirects.
Cheers!
Nice tuts!
But got a 404 on "_wdt/6d6966" while refreshing the index page.
I have _wdt route definition below "app_annotations" in config/routing.yml.
Any idea?
Of course, I find the answer right after posting my comment... :)
We just need the proper .htacces file in web folder.
Hello
Why we use:
$bundles[] = new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
And not put new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
шnto an existing array $bundles in the AppKernel.php?
Why my tool bar looks different from you show in the lesson
What mean % around %kernel.debug%?
What function they perform?
Hey Nina,
Well, in this chapter there's no any important reason do it with "$bundles[]" instead of putting it into $bundles array on initialization. But answer is simple: this bundle is related to development mode and should not be used in production. That's why we separate it from other bundles which we use in both development and production. In shorts, we can easily exclude it for production later. But technically, there're no any difference for PHP interpreter ;)
It could look differently if you upgrade Composer packages. But if you will use our locked dependencies, i.e. download course code and execute "$ composer install" instead of upgrade - it will look the same I think.
"%" is a special character when Symfony parse YAML files which means we're referencing to a parameters, i.e. "%kernel.debug%" means we're referencing to the "kernel.debug" parameter, so when Symfony parses this YAML file it will be replaced with its real value.
Cheers!
Thanks for the detailed explanation!
"Houston: no signs of life"
Start the conversation!