[php-src] Issue #19053: Property switching from virtual and to backed duplicates the property when the grandchild has a set hook
| From: | bwoebi | Date: | Sun, 06 Jul 2025 16:36:11 +0000 |
| Subject: | [php-src] Issue #19053: Property switching from virtual and to backed duplicates the property when the grandchild has a set hook | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250382@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/19053
Author: bwoebi
### Description
The following code (https://3v4l.org/AupSE#v8.4.10):
```php
<?php
abstract class GP {
public abstract mixed $foo { get; }
}
class P extends GP {
public mixed $foo;
public function x() {
++$this->foo;
return $this;
}
}
class C1 extends P {
public mixed $foo = 0 { set { parent::$foo::set($value); } }
}
var_dump((new C1)->x());
```
Resulted in this output:
```
object(C1)#1 (1) {
["foo"]=>
uninitialized(mixed)
["foo"]=>
int(1)
}
```
But I expected this output instead:
```
object(C1)#1 (1) {
["foo"]=>
int(1)
}
```
### PHP Version
```plain
PHP 8.4.10
```
### Operating System
_No response_