-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DebugBundle] Fix dump() output in API / No-Toolbar context #14478
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
Conversation
a89fd4e
to
5c60435
Compare
👍 |
5c60435
to
62f8469
Compare
@@ -140,6 +174,7 @@ public function serialize() | |||
$this->data = array(); | |||
$this->dataCount = 0; | |||
$this->isCollected = true; | |||
$this->dumper = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just added this new line to make the service reusable, aka state less after use
this looks weird to me. It means that your debugging output will not break the content of the response (a json response would not be valid json anymore for instance). And for instance, for AJAX requests, the link to the profile is available in the toolbar of the main page even though the toolbar is not injected in the ajax response. So the profile is accessible in such case. |
This is just what happens when you use var_dump(), with a better experience: currently, you either have no output at all, which is a huge WTF, or an HTML blob, regardless of the actual content-type. |
Thank you @nicolas-grekas. |
…t (nicolas-grekas) This PR was merged into the 2.6 branch. Discussion ---------- [DebugBundle] Fix dump() output in API / No-Toolbar context | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - With this PR, dumps are written as plain text when the main content-type is not HTML. With HTML, dumps are inlined when the web debug toolbar is not enabled. Commits ------- 62f8469 [DebugBundle] Fix dump() output in API/No-Toolbar context
Noticed this change today when debugging an api. Used to be that you could call "dump" and check the profiler without having a broken api response, with this change that is completely broken now. Is there any way to invoke the old behaviour? Also note, in some cases the output of dump() is way too big to be handled in a api doc interface such as Swagger or NelmioApiDoc and breaks the browser where you could just view the profiler otherwise. |
@NihilNovi please open an issue to discuss it. Reporting issues by commenting on merged PRs is not working well because anyone not reading Github notifications would miss the discussion given they will only check the opened issues and PRs |
@stof thanks, you are correct, I will do so |
With this PR, dumps are written as plain text when the main content-type is not HTML.
With HTML, dumps are inlined when the web debug toolbar is not enabled.