Repository navigation
Conversation
In a double-quoted string, PHP treats any `\u{` as the start of a code point escape and fails to parse the file when it is not a valid one, so `'\u{%04X}'` must not become `"\u{%04X}"`.
Dextheking1
reviewed
Oct 30, 2026
Dextheking1
left a comment
Contributor
There was a problem hiding this comment.
checked this one. the fix is right: without it the formatter flips the three new cases to double quotes, where they are invalid escapes. ran tests/string-double-quote on this branch, passes. put the old regex back and the snapshot fails on exactly those three cases. looks good.
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.
With the default
singleQuote: false, a single-quoted string is turned into a double-quoted one when it has no escape sequences. The check only counted a valid\u{...}code point as an escape, but PHP treats any\u{in a double-quoted string as the start of one and refuses to parse the file when it isn't valid.PHPUnit's
Sanitizerhaswhich was printed as
sprintf("\u{%04X}", ...), andphp -lthen fails withInvalid UTF-8 codepoint escape sequence. Symfony'sCliDumperandHtmlDumperhit the same thing with'\u{'.strtoupper(dechex(...)).'}'.Any
\u{now keeps the string as it is. I added these cases totests/string-double-quote/quoting.php; the snapshot showed"\u{%04X}","\u{"and"\u{zz}"before the change.yarn test(including the standalone build),AST_COMPARE=1 yarn test:nodeandyarn lintpass, and the three files above format to valid PHP again.