Avoid truncation on null bytes in class and function names - #22971
Closed
iliaal wants to merge 1 commit into
Closed
Conversation
iliaal
force-pushed
the
fix/reflection-tostring-nul-names
branch
from
July 31, 2026 13:27
455a1a0 to
ccf2ce7
Compare
iliaal
added a commit
to iliaal/php-src
that referenced
this pull request
Jul 31, 2026
Follow-up to phpGH-22681. _class_string() and _function_string() still formatted the class name and the function name with %s, so Reflection*::__toString() cut them at the first NUL. Anonymous class names embed one, both directly and inside the name of a closure declared in such a class. Closes phpGH-22971
DanielEScherzer
approved these changes
Jul 31, 2026
|
|
||
| $obj = new class { | ||
| public function make(): Closure { | ||
| return function () { }; |
Member
There was a problem hiding this comment.
Suggested change
| return function () { }; | |
| return function () {}; |
Follow-up to phpGH-22681. _class_string() and _function_string() still formatted the class name and the function name with %s, so Reflection*::__toString() cut them at the first NUL. Anonymous class names embed one, both directly and inside the name of a closure declared in such a class. Closes phpGH-22971
iliaal
force-pushed
the
fix/reflection-tostring-nul-names
branch
from
July 31, 2026 14:55
ccf2ce7 to
5d3d462
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.master already appends the class name as a zend_string, so only the function name changes once this is merged up.