[php-src] PR #23843: Fix GH-23842: skipLazyInitialization() copies unresolved constant defaults
| From: | lazerg | Date: | Tue, 22 Sep 2026 11:22:29 +0000 |
| Subject: | [php-src] PR #23843: Fix GH-23842: skipLazyInitialization() copies unresolved constant defaults | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38712@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23843
Author: lazerg
Fixes GH-23842.
skipLazyInitialization() reads the property default straight out of
ce->default_properties_table. Under shared-memory opcache the class entry is
immutable and a default that references a class constant stays an unresolved AST there; the resolved
value lives in the class's mutable data. So the method copied an IS_CONSTANT_AST
zval into the object slot, and the property then held something that is not a valid value of its
declared type: var_dump() prints UNKNOWN:0, a typed return over it throws,
and with the optimizer off it crashes.
CE_DEFAULT_PROPERTIES_TABLE() picks the mutable table when there is one, which is what
the rest of the lazy object code already does in zend_lazy_object_mark_as_initialized()
and zend_lazy_object_init(). This was the last place reading the raw field on that
path.