Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged
fabpot merged 1 commit intosymfony:3.4fromalquerci:issue-29478
Jan 5, 2019

Conversation

@alquerci
Copy link
Contributor

@alquercialquerci commentedDec 6, 2018
edited
Loading

QA
Branch?3.4
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#29478
LicenseMIT
Doc PR~

When theREQUEST_URI starts 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.

thomasbisignani reacted with thumbs up emoji
@alquercialquerci changed the base branch frommaster to3.4December 6, 2018 20:56
@alquercialquerci changed the title[HttpFoundation] Fix prepare request uri when the uri is leading with double slashes[HttpFoundation] Fix prepare request uri when it starts with double slashesDec 6, 2018
@alquercialquerci changed the title[HttpFoundation] Fix prepare request uri when it starts with double slashes[WIP] [HttpFoundation] Fix prepare request uri when it starts with double slashesDec 7, 2018
@alquercialquerci changed the title[WIP] [HttpFoundation] Fix prepare request uri when it starts with double slashes[HttpFoundation] Fix prepare request uri when it starts with double slashesDec 7, 2018
@alquercialquerciforce-pushed theissue-29478 branch 2 times, most recently frombfe7d4c toc2b69efCompareDecember 8, 2018 16:06
@alquercialquerci changed the title[HttpFoundation] Fix prepare request uri when it starts with double slashes[HttpFoundation] Fix request uri when it starts with double slashesDec 8, 2018
@alquercialquerciforce-pushed theissue-29478 branch 2 times, most recently fromefe0e35 to99151e4CompareDecember 8, 2018 17:54
@chalasrchalasr added this to the3.4 milestoneDec 9, 2018
@alquercialquerciforce-pushed theissue-29478 branch 2 times, most recently from95e9fe0 to8a7707eCompareDecember 9, 2018 19:36
@alquerci
Copy link
ContributorAuthor

alquerci commentedDec 9, 2018
edited
Loading

All code review notes answered by a code modification and the branch has been rebased and squashed.

thomasbisignani and arku31 reacted with thumbs up emoji

@danijelk
Copy link

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
Copy link
ContributorAuthor

@danijelk Thank you for your feedback.

On the majority of casesREQUEST_URI starts with a slash. Theparse_url() usage is just to handle an edge case.

Your idea is good in order to skip null and empty strings. However, it is a bit overkill regarding the occurrence of this case whileparse_url() return an empty path without an huge performance impact.

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 asReviewed status?

@nicolas-grekas
Copy link
Member

Is there a way to keep existing tests the same?
When tests change too much it raises a red flag because it means a regression is possible.
Please reduce the diff to the strict minimum to ease the work of reviewers.

@alquerci
Copy link
ContributorAuthor

alquerci commentedDec 12, 2018
edited
Loading

Is there a way to keep existing tests the same?

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.

cc@thomasbisignani

@nicolas-grekasnicolas-grekas mentioned this pull requestDec 17, 2018
Copy link

@Dylan-DutchAndBoldDylan-DutchAndBold left a comment
edited
Loading

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
Copy link
Member

@Dylan-DutchAndBold it's not: see how many tests this "solution" breaks.

@Dylan-DutchAndBold
Copy link

@Dylan-DutchAndBold it's not: see how many tests this "solution" breaks.

You're right, missed that, didn't get what you meant by your original comment at first.

@fabpot
Copy link
Member

Thank you@alquerci.

@fabpotfabpot merged commitcf850c1 intosymfony:3.4Jan 5, 2019
fabpot added a commit that referenced this pull requestJan 5, 2019
…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
@alquercialquerci deleted the issue-29478 branchJanuary 5, 2019 23:36
This was referencedJan 6, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@xabbuhxabbuhxabbuh left review comments

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

+4 more reviewers

@thomasbisignanithomasbisignanithomasbisignani left review comments

@arku31arku31arku31 left review comments

@Dylan-DutchAndBoldDylan-DutchAndBoldDylan-DutchAndBold left review comments

@ro0NLro0NLro0NL approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

11 participants

@alquerci@danijelk@nicolas-grekas@Dylan-DutchAndBold@fabpot@ro0NL@xabbuh@thomasbisignani@arku31@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp