[php-src] PR #22971: Avoid truncation on null bytes in class and function names
| From: | iliaal | Date: | Fri, 31 Jul 2026 13:27:00 +0000 |
| Subject: | [php-src] PR #22971: Avoid truncation on null bytes in class and function names | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37412@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22971
Author: iliaal
Follow-up to GH-22681.
_class_string() and _function_string() still format
the class name and the function name with %s, so Reflection*::__toString() cuts both at the first
NUL byte. Anonymous class names embed one, directly and also inside the generated name of a closure
declared in such a class.
```php
$obj = new class {
public function make(): Closure { return function () {}; }
};
echo new ReflectionFunction($obj->make());
// Closure [ <user> public method {closure:class@anonymous ] {
```
master already appends the class name as a zend_string, so only the function name changes once this
is merged up.