[php-src] PR #21788: Fix GH-21770: Infinite recursion in property hook getter in opcache preloaded trait
| From: | iliaal | Date: | Fri, 17 Apr 2026 16:26:16 +0000 |
| Subject: | [php-src] PR #21788: Fix GH-21770: Infinite recursion in property hook getter in opcache preloaded trait | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35759@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21788
Author: iliaal
Fixes #21770.
preload_fix_trait_op_array rewrites trait-cloned op_arrays from their original after
optimization and preserves a short allowlist of per-clone fields: function_name, scope, fn_flags,
prototype, static_variables. For trait-cloned property hooks, prop_info is also
per-clone. zend_do_traits_property_binding points it at the using class's
property, and zend_is_in_hook relies on that identity to detect backing-store access
from inside the hook. Without restoring prop_info, the rewrite pointed it back at the
trait's property, prototypes mismatched, and reading or writing the backing store from inside
the hook recursed into the hook instead.
Restoring prop_info alongside the other preserved fields fixes the mismatch and the
runaway recursion.