You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Infinite recursion in property hook getter in opcache preloaded trait #21770
<?phptrait a {
public ?string$a = 'a' {
get => $this->a;
}
}
class b {
use a;
}
$b = newb();
echo$b->a;
Resulted in this output when required inside of the file configured under php.ini opcache.preload:
Fatal error: Uncaught Error: Maximum call stack size of 8339456 bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? in /var/www/html/index.php:5
Stack trace:
#0 /var/www/html/index.php(5): b->$a::get()
#1 /var/www/html/index.php(5): b->$a::get()
#2 /var/www/html/index.php(5): b->$a::get()
#3 /var/www/html/index.php(5): b->$a::get()
[…]
#10192 /var/www/html/index.php(14): b->$a::get()
#10193 {main}
thrown in /var/www/html/index.php on line 5
But I expected this output instead:
a
I uploaded a full repo with what I believe to be the minimal reproduction case into https://github.com/dreistromlandMf/php-trait-property-hook-getter-opcache-preload. I could reproduce this with current PHP 8.4 as well. It doesn’t seem to reproduce using the CLI, but booth mod-apache and frankenphp do reproduce this behaviour.
This does look similar to #15240, which was marked fixed in 2024.
PHP Version
PHP 8.5.5 (cli) (built: Apr 9 2026 22:14:03) (NTS)
Copyright (c) The PHP Group
Built by https://github.com/docker-library/php
Zend Engine v4.5.5, Copyright (c) Zend Technologies
with Zend OPcache v8.5.5, Copyright (c), by Zend Technologies
Operating System
Linux 77052feff1e4 6.19.10-hardened1-1-hardened #1 SMP PREEMPT_DYNAMIC Sat, 28 Mar 2026 00:27:17 +0000 x86_64 GNU/Linux
Activity
Fix phpGH-21770: Infinite recursion in property hook getter in opcach…
Fix infinite recursion in property hook getter in opcache preloaded t…