View Issue Details

IDProjectCategoryView StatusLast Update
0001777XdebugStep Debuggingpublic2020-06-20 15:07
Reportersargon1404Assigned To 
Status acknowledgedResolutionopen 
Product Version2.9.3 
Target VersionFixed in Version 
Summary0001777: var_dump ignores __debugInfo()
DescriptionGreetings gentlemen,

I'll begin my report by stating i'm perfectly aware of the 0001662 fix - __debugInfo should not be used for user-defined classes [ ], 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.

class Foo
     protected $db ;
    protected $request;
    protected $dep1;
    protected $dep2;

    protected $prop1 = '';
    protected $prop2 = '';

    public function __construct(Database $db, Request $request, Dep1 $dep1, Dep2 $dep2)
        $this->db = $db;
        $this->request = $request;
        $this->dep1 = $dep1;
        $this->dep2 = $dep2;
     public function __debugInfo()
        $properties = get_object_vars($this);

        unset($properties['db'], $properties['request'], $properties['dep1'], $properties['dep2']);

        return $properties;

TagsNo tags attached.
Operating System
PHP Version7.4.0-7.4.4


There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2020-04-11 11:25 sargon1404 New Issue
2020-06-20 15:07 derick Status new => acknowledged