[php-src] Issue #15280: Infinite recursion in property hooks inside traits.
| From: | SerafimArts | Date: | Wed, 07 Aug 2024 20:32:07 +0000 |
| Subject: | [php-src] Issue #15280: Infinite recursion in property hooks inside traits. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247459@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15280
Author: SerafimArts
### Description
Referenced RFC https://github.com/php/php-src/pull/13455
## Positive Case
```php
<?php
class FirstExample
{
public string $value = 'default' {
get => $this->value;
}
}
echo new FirstExample()->value; // "example"
```
## Negative Case
```php
<?php
trait TraitWithProperty
{
public string $value = 'default' {
get => $this->value;
}
}
class SecondExample
{
use TraitWithProperty;
}
echo new SecondExample()->value;
// Fatal error: Uncaught Error: Maximum call stack size of 8339456 bytes
(zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? in
/test.php:15
// Stack trace:
// #0 /test.php(15): SecondExample->$value::get()
// #1 ....
```
@iluuu1994 I think it makes sense to mention you as the maintainer of the feature. It seems like
this is not a duplicate issue, a known problem?
### PHP Version
PHP 8.4-alpha2
### Operating System
_No response_