View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0001777||Xdebug||Step Debugging||public||2020-04-11 11:25||2022-04-21 09:13|
|Summary||0001777: var_dump ignores __debugInfo()|
I'll begin my report by stating i'm perfectly aware of the 0001662 fix - __debugInfo should not be used for user-defined classes [ https://bugs.xdebug.org/bug_view_page.php?bug_id=00001662 ], however i'll kindly ask you to reconsider this fix, since in my opinion, it does more harm than good when you factor dependency injection into the mix.
Consider for example the below class. If __debugInfo() is ignored, in the output of var_dump i'll see a lot of info i don't want to see, especially since, if using a framework, the Database/Request/other dependencies etc.... will be on the heavy-weight - output wise - size.
At the moment, var_dump is not very helpful, at least for me, except for the most basic cases. Injecting dependencies into a class produces to much 'background noise', preventing me from quickly seeing what the values of the properties i'm interested to see are.
|Tags||No tags attached.|
I would like to second sargon1404.
The magic method __debugInfo() was introduced in PHP in order to allow for custom debug information. Especially in user-defined classes.
Having a very different behavior with and without xdebug is very confusing, even more so as the user does initially not understand why __debugInfo() does not work like specified in the PHP specs.
As there seem to be different opinions on the use of debugInfo() in custom classes, I would like to suggest creating a switch in the xdebug configuration to disable debugInfo() for custom classes. The default, in my opinion, should be to have var_dump() work according to the PHP specs.
There is a workaround for this, which is to set a watch called "$this->__debugInfo()". Setting watches is supported by many IDEs.
Because there is a workaround, I am not reverting this to its original state.
If you want to see the "debugInfo" of all object, please ask your IDE producer to include functionality to call this method on every object.
|2020-04-11 11:25||sargon1404||New Issue|
|2020-06-20 15:07||derick||Status||new => acknowledged|
|2021-01-10 20:14||xleo||Note Added: 0005637|
|2021-03-17 09:14||derick||Assigned To||=> derick|
|2021-03-17 09:14||derick||Status||acknowledged => resolved|
|2021-03-17 09:14||derick||Resolution||open => won't fix|
|2021-03-17 09:14||derick||Note Added: 0005735|
|2022-04-21 09:13||derick||Description Updated|