Repository navigation
Conversation
Contributor
|
Nice catch! That was a subtle PCRE quirk — The fix The regression test clearly captures the bug and fails without this change. Optional non-blocking suggestions:
LGTM! 👍 |
Contributor
Author
|
Thanks for the review @gr8man! Fair point on those edge cases — just pushed a commit adding the 9-placeholder boundary and an out-of-range $11 check to lock in the '' behavior. |
Contributor
|
You need to fix the tests. composer cs-fix |
Contributor
Author
This branch has not been deployed
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.
Description
When
Config\Routing::$multipleSegmentsOneParamistrue,Router::replaceBackReferences()previously built the regex pattern as'/$([1-' . count($matches) . '])/u'.When a route had 9 or more placeholders (
count($matches) >= 10), the character class became[1-10](or[1-11], etc.), which in PCRE matches only the range'1'–'1'(or'0'). As a result:$2through$9were not replaced at all and remained literal'$2'..'$9'strings.$10had only the$1prefix replaced, corrupting the parameter value.This PR changes the pattern in
Router::replaceBackReferences()to'/$([1-9][0-9]*)/u'so both single-digit ($1–$9) and multi-digit ($10+) back-references are properly matched and replaced.Checklist: