Skip to content

How to force Symfony/Var-Dumper to use __debugInfo() method? #33952

@gzhegow1991

Description

@gzhegow1991

I saw there is $hasDebugInfo variable in Caster.php, and its detecting correctly, but when i dumping my variable i still see those variables that been removed inside __debugInfo() as object properties.

For example - am trying to hide "container" property from object (container is very big to process it)

public function __debugInfo()
{
  $data = get_object_vars($this);
  unset($data['container']);
  return $data;
}

dd($object); // MyObject ( #container: ... )
var_dump($object); // object(MyObject)#23 {}

Hope, somebody could help me...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions