Description
Lazy proxies transparently forward all calls to the underlying instance, including things like get_class
:
https://3v4l.org/QEXKP#v8.4.1
This transparency does not however extend to spl_object_id
and spl_object_hash
...
This makes recursion detection in userspace dumpers like symfony/var-dumper and kint-php/kint very difficult, since we have no other (fast) way of distinguishing object instances:
https://3v4l.org/Ad9CN#v8.4.1
In this simplified example we can see that while dumping $z
correctly detects recursion after one "Loop", dumping $x
takes two loops since the object id/hash of the contained proxy don't match the internal instance.
Lazy ghosts don't have this problem, but we don't have a userspace way of telling ghosts apart from proxies anyway.
PHP Version
PHP 8.4.1
Operating System
No response