ext/standard: Add dd function#22407
Conversation
|
Given the obvious conflict with userland, this will require an RFC. |
TimWolla
left a comment
There was a problem hiding this comment.
Besides the one technical remark, this will also require tests (including tests where the var_dump() itself throws an exception).
| { | ||
| ZEND_FN(var_dump)(INTERNAL_FUNCTION_PARAM_PASSTHRU); | ||
|
|
||
| zend_bailout(); |
There was a problem hiding this comment.
Bailouts are mainly to be used for “unclean” exits. Use zend_throw_unwind_exit() instead.
|
Why would we want this in core php? |
|
The biggest objection here is the userland conflict, and I think it can be turned into the strongest argument for a well-designed version of this feature. The current implementation is So if this goes the RFC route, I'd argue the handler is not an optional extra — it's the core of the design. Expose a way to register a custom set_dump_handler(function (DumpStructure $dump): void {
// framework/tool decides how to render, where to send, when to exit
});Frameworks and tools override it; everyone else gets the default. There's an upside beyond not-breaking-things. Today dumpers resort to reflection and some hacks to extract complete information from a value. If the handler receives a structured representation of the dumped value ( |
|
I'm confuse because already there is |
Because, Symfony and Laravel is future 😀 |
Dump and Die |
|
Thank you for contributing to php. As this is adding a new function, it would be appreciated to add corresponding tests into the pull request to make sure things work. You might also need to fix the stub error in CI. Also, we generally requires a RFC to let the majority of the community to vote for new features. See here for guidance in how to launch a RFC process. |
|
Please only implement self explaining function names. |
|
On their video the author has commented:
Just pointing that out in case maintainers were spending time on this, expecting an RFC. |
|
Okay, I'll close. |
edit: this pull request is in
draftand not ready for review because it was created for the purpose of explaining to the community how they can contribute to PHP’s source code.here is the video on it: youtu.be/FBtPOg5GxYA?si=MrTPPldwhHKaokcJ