Skip to content

Commit

Permalink
Fix uninitialized typed property
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghostff committed Feb 8, 2020
1 parent 50c17e7 commit 80a5448
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Dump.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,16 @@ private function formatObject($object): string
}

$prop->setAccessible(true);
$new_obj = $prop->getValue($object);
$tmp .= "{$from} {$this->color("'{$prop->getName()}'", 'property_name')} {$arrow_color} {$this->evaluate([$new_obj], true, true)}";
if ($prop->isInitialized($object))
{
$value = $this->evaluate([$prop->getValue($object)], true, true);
}
else
{
$value = $this->type('uninitialized');
}

$tmp .= "{$from} {$this->color("'{$prop->getName()}'", 'property_name')} {$arrow_color} {$value}";
}

if ($tmp != '')
Expand Down

0 comments on commit 80a5448

Please sign in to comment.