[php-src] Issue #10840: [PHP@master] Reflection method does not exist for private method from parent class
| From: | kubawerlos | Date: | Sun, 12 Mar 2023 22:54:22 +0000 |
| Subject: | [php-src] Issue #10840: [PHP@master] Reflection method does not exist for private method from parent class | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243900@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10840
Author: kubawerlos
### Description
The following code:
```php
<?php
class C1 { public function t1() {} }
class C2 { protected function t2() {} }
class C3 { private function t3() {} }
$method = new \ReflectionMethod(new class extends C1 {}, 't1'); // this is fine
$method = new \ReflectionMethod(new class extends C2 {}, 't2'); // this is fine
$method = new \ReflectionMethod(new class extends C3 {}, 't3'); // Fatal error: Uncaught
ReflectionException: Method C3@anonymous::t3() does not exist
```
Resulted in this output:
```
Fatal error: Uncaught ReflectionException: Method C3@anonymous::t3() does not exist in /in/bJ2af:9
Stack trace:
#0 /in/bJ2af(9): ReflectionMethod->__construct(Object(C3@anonymous), 't3')
#1 {main}
thrown in /in/bJ2af on line 9
Process exited with code 255.
```
But I expected this output instead:
```
```
It happens only on
master branch, 8.2.3 is not affected.
https://3v4l.org/bJ2af/rfc#vgit.master
### PHP Version
master
### Operating System
_No response_