-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[VarDumper] Add VAR_DUMPER_FORMAT=server format #35967
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
[VarDumper] Add VAR_DUMPER_FORMAT=server format #35967
Conversation
@nicolas-grekas : I've updated the PR, so it should work now using |
@@ -5,6 +5,8 @@ CHANGELOG | |||
----- | |||
|
|||
* added `RdKafka` support | |||
* added `VAR_DUMPER_FORMAT=server` support | |||
* prevent replacing the handler when the `VAR_DUMPER_FORMAT` env var is set |
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.
Btw what about considering this behavior as a bug fix? Getting something else than the expected format when using VAR_DUMPER_FORMAT
looks unexpected to me.
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.
What do you think about this? Bug fix or not bug fix?
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.
Works for me this way. Here are some ideas to go a bit further. WDYT?
Thank you @ogizanagi. |
…RMAT (ogizanagi) This PR was merged into the 4.4 branch. Discussion ---------- [VarDumper] Backport handler lock when using VAR_DUMPER_FORMAT | Q | A | ------------- | --- | Branch? | 4.4 <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | N/A <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | N/A Backport of the "lock" behavior from #35967, preventing unexpected handler change when using the `VAR_DUMPER_FORMAT` env var. --- As a concrete example of this not working as expected: Start a PHPUnit test suite with this env var to the desired format. If a web test case is making a request (with debug enabled), the `DebugBundle` replaces the handler set initially by the `VAR_DUMPER_FORMAT`, will collect dumps into the profiler, but won't output these. As well, for dumps made in between the the kernel is boot (`DebugBundle::build()` is called) and a request, the dumps are properly sent to the output with expected format, but looses colors. IMHO, the use-cases of `VAR_DUMPER_FORMAT` justifies locking the handler for the whole process. Commits ------- 19b341e [VarDumper] Backport handler lock when using VAR_DUMPER_FORMAT
This PR follows discussion in #35801 and adds support for a
server
value for the existingVAR_DUMPER_FORMAT
env var.It comes as well with two more things:
the handler is registered as soon as thewe prevent registering another handler as soon as theVAR_DUMPER_FORMAT
env var is detectedVAR_DUMPER_FORMAT
env var is set, instead of checking if there was a previous handler (which could make this env var useless in some conditions where the handler was already set by another "process")This PR means anyone can use dump with a server in any context, without changing a single line of code in the project by:
./vendor/bin/var-dump-server --format=html > dumps.html
VAR_DUMPER_FORMAT=server [your-cli-command]
Previous related PRs: