Skip to content

Use REQUEST_URI instead of PATH_INFO (#18050) - #18059

Merged
markstory merged 2 commits into
4.xfrom
4x-request-uri
Dec 10, 2024
Merged

markstory merged 2 commits into
4.xfrom
4x-request-uri

Conversation

@markstory

Copy link
Copy Markdown
Member

Switch to using REQUEST_URI (via diactoros/Uri) instead of reading from PATH_INFO. The PATH_INFO value includes URL decoding which can allow encoded URLs to match routes when they shouldn't.

Remove urldecode in RouteCollection

This was contributing to %2f getting through routing. We have to retain backwards compatibility with urlencoded path segements as users expect those to be exposed to application code in a decoded state.

Backport of #18050 to 4.x

Switch to using REQUEST_URI (via diactoros/Uri) instead of reading from
PATH_INFO. The PATH_INFO value includes URL decoding which can allow
encoded URLs to match routes when they shouldn't.

Remove urldecode in RouteCollection

This was contributing to %2f getting through routing. We have to retain
backwards compatibility with urlencoded path segements as users expect
those to be exposed to application code in a decoded state.

Backport of #18050 to 4.x
@markstory markstory added this to the 4.5.9 milestone Dec 6, 2024
Comment thread src/Http/ServerRequestFactory.php Outdated
Comment thread src/Http/ServerRequestFactory.php Outdated
@markstory
markstory merged commit 87b9d1a into 4.x Dec 10, 2024
@markstory
markstory deleted the 4x-request-uri branch December 10, 2024 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants