-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
WIP [DebugBundle] Allow configuring a dumper while collecting dumps, add a default one writing to stderr when the cli-server is in use #14373
Conversation
if ('cli-server' === PHP_SAPI) { | ||
$cloner = new VarCloner(); | ||
$dumper = new CliDumper('php://stderr', $this->charset); | ||
$dumper->dump($cloner->cloneVar(sprintf('In %s on line %d', $file, $line))); |
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.
shouldn't you just write to php://stderr
instead of using the dumper ? Having all the info about the string does not make much sense IMO, and it could even get truncated by the dumper
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.
It's a shortcut to benefit from auto-selection of color support, but yes, it's possible.
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.
but does it need to be colored as dumped strings ? It would be confusing in case the dumped value is also a string
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 think so, but maybe in a different color/background. That's the kind of things we can tweak if the main idea is appealing to a majority.
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.
the idea looks good to me
👍 I like the idea. Mostly because I think it feels like the natural behavior that you'd expect when using the built-in web server and the My only concern is: will it become a mess if I output a lot of variables or few but complex variables? |
a7d1a6b
to
f6e4455
Compare
f6e4455
to
64d5cbe
Compare
64d5cbe
to
013f549
Compare
…olas-grekas) This PR was merged into the 2.6 branch. Discussion ---------- [DebugBundle] Allow alternative destination for dumps | Q | A | ------------- | --- | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #14608 | License | MIT | Doc PR | - This PR fixes #14608 by adding a new `debug.dump_destination` configuration option to give users control over a stream destination where dumps will be written to. In HTTP mode, dumps are still/also collected in the toolbar. This supersedes #14627, #14631 and #14373 Commits ------- 5f255e5 [DebugBundle] Allow alternative destination for dumps 5368483 [DebugBundle] Use output mechanism of dumpers instead of echoing 8cb2abb [DebugBundle] Always collect dumps
When
dump()
is called, you all know this happens:With this PR, dumps are duplicated in the console output of a
php -S
process:This does not work with php app/console server:run but that is for an other PR.