Skip to content

Update "Web debug toolbar" profiler docs #17809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2023

Conversation

florimondmanca
Copy link
Contributor

@florimondmanca florimondmanca commented Jan 25, 2023

Hello,

I believe I encountered the situation than symfony/symfony#42439

The current docs on updating the Web debug toolbar after XHR requests suggest to use $event->getKernel()->isDebug().

I am using Symfony 6.2, and this results in an attribute error on isDebug(). This seems to be because getKernel() returns an object that implements HttpKernelInterface, which does not define isDebug(). However, this method is available on KernelInterace.

I was able to get the intended behavior by injecting the kernel via the constructor, as shown in this documentation update proposal.

I checked as follows:

  • Run the app with APP_ENV=dev. The toolbar shows up and I can see Symfony-Debug-Toolbar-Replace: 1 in the XHR requests (I'm using Turbo Frames)
  • Run with APP_ENV=prod. The toolbar doesn't show up, and I cannot see Symfony-Debug-Toolbar-Replace: 1 in the XHR requests anymore.

I am targeting 5.4 as the base branch as per the contribution guidelines, given that it should be possible to inject the KernelInterface in Symfony 5.4 as well.

@florimondmanca florimondmanca marked this pull request as ready for review January 25, 2023 17:01
@florimondmanca florimondmanca changed the base branch from 6.2 to 5.4 February 21, 2023 11:17
@florimondmanca florimondmanca force-pushed the patch-1 branch 2 times, most recently from bc44772 to d233a68 Compare February 21, 2023 11:20
@javiereguiluz
Copy link
Member

@florimondmanca sorry it took us so long to merge this. Thanks a lot for fixing this issue ... and congrats on your first Symfony Docs contribution 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants