[php-src] PR #24718: Fix GH-24715: Lazy ghost reset by a destructor while releasing its initializer
| From: | lazerg | Date: | Mon, 26 Oct 2026 06:02:16 +0000 |
| Subject: | [php-src] PR #24718: Fix GH-24715: Lazy ghost reset by a destructor while releasing its initializer | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39891@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24718
Author: lazerg
When a lazy ghost finishes initializing,
zend_lazy_object_init() deletes its info
entry, and that is where the initializer gets released. The hash removes the entry before running
its destructor, so any destructor fired by releasing the initializer (here a
gc_collect_cycles() in the initializer's __destruct) no longer sees
the stale info and is allowed to call resetAsLazyGhost() on the object.
zend_lazy_object_init() then returns an object that is lazy again, and
zend_lazy_object_get_properties() asserts.
The fix releases the initializer before the info entry is deleted, so a reset at that point throws
"Can not reset an object while it is being initialized", the same as during the
initializer call. Lazy proxies already release their initializer this way.
Fixes #24715