[GIT-PULLS] [php-src] PR #22970: Parse qualified reflection names with a length-aware search

[email protected] (iliaal) Fri, 31 Jul 2026 13:26:58 +0000
Newsgroups php.git-pulls
Message-ID <[email protected]>
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.