Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HttpFoundation] Fix request uri when it starts with double slashes#29494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
bfe7d4c toc2b69efCompareefe0e35 to99151e4CompareUh oh!
There was an error while loading.Please reload this page.
95e9fe0 to8a7707eCompareUh oh!
There was an error while loading.Please reload this page.
alquerci commentedDec 9, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
All code review notes answered by a code modification and the branch has been rebased and squashed. |
danijelk commentedDec 12, 2018
Maybe extract the if( empty $requestUri string ) to jump over the if/else, unless you actually want to send an empty string into parse_url()? Just micro optimizations. I tested it with our setup and it worked well. |
alquerci commentedDec 12, 2018
@danijelk Thank you for your feedback. On the majority of cases Your idea is good in order to skip null and empty strings. However, it is a bit overkill regarding the occurrence of this case while So to keep the code simple (as we cannot use here an early return) I think that this micro optimization adds useless complexity. @nicolas-grekas Do you think that we can turn this PR as |
nicolas-grekas commentedDec 12, 2018
Is there a way to keep existing tests the same? |
alquerci commentedDec 12, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Yes for sure. I can revert them. @nicolas-grekas FYI: Tests has been refactored on this commit95e9fe0 then squashed. Its tests has been added on#29256. |
Uh oh!
There was an error while loading.Please reload this page.
Dylan-DutchAndBold left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Isn't this guy's solution where he is just using the parse_url function correctly, much more obvious and readable?a3cbb65
nicolas-grekas commentedDec 18, 2018
@Dylan-DutchAndBold it's not: see how many tests this "solution" breaks. |
Dylan-DutchAndBold commentedDec 18, 2018
You're right, missed that, didn't get what you meant by your original comment at first. |
fabpot commentedJan 5, 2019
Thank you@alquerci. |
…e slashes (alquerci)This PR was merged into the 3.4 branch.Discussion----------[HttpFoundation] Fix request uri when it starts with double slashes| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#29478| License | MIT| Doc PR | ~When the `REQUEST_URI` starts with a slash no need to `parse_url()`. However to keep the same behaviour regarding the fragment we need to add a logic to remove it. While `parse_url()` handle all cases itself.Commits-------cf850c1 [HttpFoundation] Fix request uri when it starts with double slashes
Uh oh!
There was an error while loading.Please reload this page.
When the
REQUEST_URIstarts with a slash no need toparse_url(). However to keep the same behaviour regarding the fragment we need to add a logic to remove it. Whileparse_url()handle all cases itself.