[php-src] Issue #9405: ReflectionClass not return private elements of parent classes
| From: | WinterSilence | Date: | Tue, 23 Aug 2022 01:25:26 +0000 |
| Subject: | [php-src] Issue #9405: ReflectionClass not return private elements of parent classes | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242289@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9405
Author: WinterSilence
### Description
The following code:
```php
<?php
class A
{
private $privateProperty = 1;
private function privateMethod() {}
}
class B extends A {}
$class = new ReflectionClass('B');
echo (string) $class;
```
Resulted in this output:
```
Class [ <user> class B extends A ] {
...
- Properties [0] {
}
- Methods [0] {
}
}
```
But I expected this output instead:
```
Class [ <user> class B extends A ] {
...
- Properties [1] {
Property [ private $privateProperty = 1 ]
}
- Methods [1] {
Method [ <user, inherits A> private method privateMethod ] {
@@ ...
}
}
}
```
### PHP Version
PHP 8.0.22
### Operating System
_No response_