Repository navigation
[BUGFIX] Handle strings in at-rule preludes - #1650
Conversation
JakeQZ
left a comment
There was a problem hiding this comment.
Thanks @sean0407, this looks very good <3.
But I think we need additional testing for the backslash handling, and also suggest using regex for that to make it easier for the reader to follow. (It took me a while to work out what the loop was doing.)
e8e2346 to
1bd9468
Compare
JakeQZ
left a comment
There was a problem hiding this comment.
This is looking excellent now, though I think it would also be good to have a test with a backslash within an argument string but not at the end.
Also, by convention, we put the PR number in the changelog, and newer entries first.
(I was hitherto unaware that \z could be used in a regex as the equivalent of $.)
JakeQZ
left a comment
There was a problem hiding this comment.
LGTM now. Thanks @sean0407 for contributing <3.
@oliverklee, do you spot any issues, or is this good to go?
The changelog entry ordering can be adjusted post-PR. We normally only reference the PR number, but I don't see a reason not to reference the bug number as well.
oliverklee
left a comment
There was a problem hiding this comment.
Beautiful! Thank you for contributing this, @sean0407! ❤️
Problem
In a generic at-rule prelude, a quoted string containing
{or;was treated as a parser delimiter. For example,@media (custom: "a;b{c}") { ... }could end the prelude before its actual block and fail to preserve the following stylesheet rules. This addresses #1625.Change
Scan quoted strings as part of the at-rule arguments, honoring escaped characters before continuing to look for the actual
{or;delimiter. Add a regression test that checks both the parsed at-rule arguments and the rule following the at-rule, and document the fix in the changelog.Verification
Ran in an isolated PHP 8.5.11 container with no GitHub credentials; network was disconnected during test and static-analysis execution:
.phive/php-cs-fixerexecutable is not present in this checkout.Fixes #1625