DDC-2107: Debug::dump lists the wrong access level for some attributes #2655

Closed
opened 2026-01-22 13:59:26 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Oct 29, 2012).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user gzankevich:

\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
Originally created by @doctrinebot on GitHub (Oct 29, 2012). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user gzankevich: \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 ```
admin added the Improvement label 2026-01-22 13:59:26 +01:00
admin closed this issue 2026-01-22 13:59:26 +01:00
Author
Owner

@doctrinebot commented on GitHub (Feb 9, 2013):

Comment created by @asm89:

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.

@doctrinebot commented on GitHub (Feb 9, 2013): Comment created by @asm89: 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.
Author
Owner

@doctrinebot commented on GitHub (Feb 9, 2013):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Feb 9, 2013): Issue was closed with resolution "Invalid"
Author
Owner

@doctrinebot commented on GitHub (Feb 9, 2013):

Comment created by @ocramius:

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

@doctrinebot commented on GitHub (Feb 9, 2013): Comment created by @ocramius: 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
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2655