[php-src] PR #22970: Parse qualified reflection names with a length-aware search
| From: | iliaal | Date: | Fri, 31 Jul 2026 13:26:58 +0000 |
| Subject: | [php-src] PR #22970: Parse qualified reflection names with a length-aware search | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37411@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22970
Author: iliaal
ReflectionMethod::__construct(), ReflectionMethod::createFromMethodName() and
ReflectionClass::getProperty() split a Class::member argument with strstr(), which
stops at the first NUL byte. Anonymous class names embed one, so a name that
ReflectionClass::getName() just handed back is rejected. zend_memnstr() searches the
declared length instead.
```php
$obj = new class { public function m() {} };
$name = (new ReflectionClass($obj))->getName();
ReflectionMethod::createFromMethodName($name . '::m');
// ReflectionException: Argument #1 ($objectOrMethod) must be a valid method name
```
These are the same two lines #22922 rewrites to fix the NUL truncation in the exception messages, so
one of the two will need a rebase.