Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
May 5, 2015

Conversation

nicolas-grekas
Copy link
Member

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.

@fabpot
Copy link
Member

fabpot commented Apr 27, 2015

👍

@nicolas-grekas nicolas-grekas changed the title [DebugBundle] Fix dump() output in API/non-HTML context [DebugBundle] Fix dump() output in API / No-Toolbar context Apr 27, 2015
@@ -140,6 +174,7 @@ public function serialize()
$this->data = array();
$this->dataCount = 0;
$this->isCollected = true;
$this->dumper = null;
Copy link
Member Author

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

@stof
Copy link
Member

stof commented Apr 28, 2015

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).
This seems a bad idea IMO.

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.

@nicolas-grekas
Copy link
Member Author

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.

@fabpot
Copy link
Member

fabpot commented May 5, 2015

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 62f8469 into symfony:2.6 May 5, 2015
fabpot added a commit that referenced this pull request May 5, 2015
…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
@MichaelHindley
Copy link

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.

@stof
Copy link
Member

stof commented May 11, 2015

@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

@MichaelHindley
Copy link

@stof thanks, you are correct, I will do so

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

Successfully merging this pull request may close these issues.

4 participants