diff --git a/src/Tracy/Dumper/Exposer.php b/src/Tracy/Dumper/Exposer.php index 87106d7f3..c978dd7a8 100644 --- a/src/Tracy/Dumper/Exposer.php +++ b/src/Tracy/Dumper/Exposer.php @@ -334,7 +334,7 @@ private static function exposeLazyObject(object $obj, Describer $describer, Valu { $rc = new \ReflectionClass($obj); foreach ($rc->getProperties() as $prop) { - if ($prop->isStatic() || $prop->isLazy($obj) || !$prop->isInitialized($obj)) { + if ($prop->isStatic() || $prop->isLazy($obj) || $prop->isVirtual() || !$prop->isInitialized($obj)) { continue; } diff --git a/tests/Dumper/Dumper.toText().specials.lazyObject.virtual.phpt b/tests/Dumper/Dumper.toText().specials.lazyObject.virtual.phpt new file mode 100644 index 000000000..be024f6f5 --- /dev/null +++ b/tests/Dumper/Dumper.toText().specials.lazyObject.virtual.phpt @@ -0,0 +1,47 @@ + $this->title . '!'; + } +} + +$rc = new ReflectionClass(LazyClassWithVirtualProp::class); +$ghost = $rc->newLazyGhost(function () {}); + +// new ghost - virtual property should not appear (it has no backing value) +Assert::match( + <<<'XX' + LazyClassWithVirtualProp (lazy) #%d% + XX, + Dumper::toText($ghost, [Dumper::DEPTH => 3]), +); + +// preinitialized property - virtual property should still not appear +$rc->getProperty('id')->setRawValueWithoutLazyInitialization($ghost, 123); + +Assert::match( + <<<'XX' + LazyClassWithVirtualProp (lazy) #%d% + id: 123 + XX, + Dumper::toText($ghost, [Dumper::DEPTH => 3]), +);