Repository navigation
Conversation
Anonymous class names contain a NUL byte. Since the %pS migration some error messages print the full name, but the error log, HTML fatal error and XML-RPC output still formatted the message as a C string, cutting it at the NUL (e.g. "PHP Fatal error: Class class@anonymous in ..."). Log NUL bytes as \0 and print display output by length. Also use %pS for the remaining Zend, dom and xmlreader messages that still truncated anonymous class names via ZSTR_VAL().
devnexen
approved these changes
Nov 9, 2026
arnaud-lb
added a commit
to jorgsowa/php-src
that referenced
this pull request
Nov 11, 2026
* PHP-8.6: Fix error buffer cleanup in phar_open_parsed_phar() (php#25376) Fix phpGH-25306: Assertion status == LXB_STATUS_OK in dom_parse_selector when lexbor allocation fails Fix AST printing dropping readonly on promoted parameters (phpGH-25207) Fix truncated anonymous class names in error messages and logs (phpGH-25352) ext/gd: blame the points array when a polygon has too few points ext/gd: keep the brush and tile images alive while the destination uses them ext/standard/dns.c: drop partially built records in php_parserr()
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.
I detected this problem while working on PHP Parser in Rust.
Anonymous class names contain a NUL byte (
class@anonymous\0file:line$0). Since the%pSmigration (#23142), some error messages include the full name, which exposed two problems:Messages cut off in output.
php_error_cb()still wrote the message as a C string in the error log, the HTML fatal error output and the XML-RPC fault, so it stopped at the NUL:PHP Fatal error: Class class@anonymous in Standard input code on line 2
The log now writes NUL bytes as
\0(log sinks take C strings), and the HTML/XML-RPC output prints the message by length.Inconsistent names. Messages not covered by the migration still printed the short name via
ZSTR_VAL()/ZEND_FN_SCOPE_NAME(), sometimes both forms in one message:Class class@anonymous\0…:2$0 must implement 1 abstract method (class@anonymous::$p::get)
These now use
%pS: inheritance errors (abstract method list,#[\Override], access level, static/abstract), private method/destructor calls,private(set)and readonly modification, return type, too few arguments, by-ref unpacking, virtual property unserialization,DOMXPath::__construct()reentry and XMLReader readonly properties.ext/filter is covered by #23155.