Conversation
…root sub-routes - Router::redirect() now forwards query string parameters from the original request to the redirect target. Fixes #303. - fixUriPath() now checks strlen before accessing $path[0] in the while loop, preventing 'Uninitialized string offset 0' when grouping sub-routes under root path '/'. Fixes #302.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #308 +/- ##
============================================
- Coverage 74.89% 74.89% -0.01%
- Complexity 2973 2976 +3
============================================
Files 97 97
Lines 9508 9511 +3
============================================
+ Hits 7121 7123 +2
- Misses 2387 2388 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
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.



Summary
Two routing bug fixes: preserve query string parameters during redirects, and prevent crash when grouping sub-routes under root path
"/".Motivation
Router::redirect()silently drops query string parameters, breaking use cases like/?lang=ENredirecting to/dashboard?lang=EN. Fixes bug(routing): Router::redirect() drops query string parameters #303."/"causesUninitialized string offset 0infixUriPath()because thewhileloop trims the path to an empty string then accesses index 0. Fixes bug(routing): Uninitialized string offset when grouping sub-routes under root path '/' #302.Changes
Router::redirect()closure, read query string from the requested URI viaRouter::getRouteUri()->getRequestedUri()and append it to the redirect targetfixUriPath(), addedstrlen($path) > 0guard to thewhileloop conditionHow to Test / Verify
"/"parent path and verify no crashBreaking Changes and Migration Steps
None
Checklist
Related issues
Closes #302
Closes #303