[DDC-2107] Debug::dump lists the wrong access level for some attributes Created: 29/Oct/12  Updated: 09/Feb/13  Resolved: 09/Feb/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: 2.2.2
Fix Version/s: None

Type: Improvement Priority: Trivial
Reporter: George Zankevich Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None
Environment:

Linux



 Description   

\Doctrine\Common\Util\Debug::dump() shows the wrong access level for some attributes. The below code reproduces the bug:

\Doctrine\Common\Util\Debug::dump(
    new \Doctrine\ORM\Query\Expr\Select()
);

\Doctrine\ORM\Query\Expr\Select and \Doctrine\ORM\Query\Expr\Base define a bunch of protected class attributes, however, the Dump method fails to indicate their correct access level.

Expected result:

object(stdClass)[740]
  public '__CLASS__' => string 'Doctrine\ORM\Query\Expr\Select' (length=30)
  protected 'preSeparator' => string '' (length=0)
  protected 'postSeparator' => string '' (length=0)
  protected 'allowedClasses' => 
    array (size=1)
      0 => string 'Doctrine\ORM\Query\Expr\Func' (length=28)
  protected 'separator' => string ', ' (length=2)
  protected 'parts' => 
    array (size=0)
      empty

Actual result:

object(stdClass)[740]
  public '__CLASS__' => string 'Doctrine\ORM\Query\Expr\Select' (length=30)
  public 'preSeparator' => string '' (length=0)
  public 'postSeparator' => string '' (length=0)
  public 'allowedClasses' => 
    array (size=1)
      0 => string 'Doctrine\ORM\Query\Expr\Func' (length=28)
  public 'separator' => string ', ' (length=2)
  public 'parts' => 
    array (size=0)
      empty


 Comments   
Comment by Alexander [ 09/Feb/13 ]

This is not a bug. It's the way the dumper works. The functionality of the dumper lies within limiting the depth of the dumping. It does this by reconstructing the object in an `stdClass` object. If you have xdebug installed this will show all the properties as public.

Comment by Marco Pivetta [ 09/Feb/13 ]

This is not a bug, but a limitation. Since values are copied over from a real instance into an `stdClass`, we cannot reproduce the original object's property visibility

Generated at Sun Apr 20 08:55:34 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.