[php-src] Issue #24147: ReflectionProperty class and name properties are documented as Read-only, but they can be changed.
| From: | kamil-tekiela | Date: | Mon, 05 Oct 2026 20:23:47 +0000 |
| Subject: | [php-src] Issue #24147: ReflectionProperty class and name properties are documented as Read-only, but they can be changed. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-252907@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/24147
Author: kamil-tekiela
### Description
The following code:
```php
<?php
class B {
public string $x;
}
$prop = new ReflectionProperty('B', 'x');
$prop->class .= 'Z';
var_dump($prop->class, $prop->getDeclaringClass()->name);
```
Resulted in this output:
```
string(2) "BZ"
string(1) "B"
```
But I expected this output instead:
```
string(2) "B"
string(1) "B"
```
### PHP Version
```plain
Any PHP version.
```
### Operating System
_No response_