From 80a5448410f5412c42c65b73b1307ff8f0a8180b Mon Sep 17 00:00:00 2001 From: Ghostff Date: Sat, 8 Feb 2020 14:40:54 -0600 Subject: [PATCH] Fix uninitialized typed property --- src/Dump.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Dump.php b/src/Dump.php index de330a6..15b2804 100644 --- a/src/Dump.php +++ b/src/Dump.php @@ -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 != '')