Skip to content

Loading…

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

Closed
doctrinebot opened this Issue · 3 comments

2 participants

@doctrinebot

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
@doctrinebot

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

Issue was closed with resolution "Invalid"

@doctrinebot

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

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.