fix: sync $_REQUEST after modifying $_GET in SiteURIFactory#10205
Open
jalexiscv wants to merge 1 commit into
Open
fix: sync $_REQUEST after modifying $_GET in SiteURIFactory#10205jalexiscv wants to merge 1 commit into
jalexiscv wants to merge 1 commit into
Conversation
|
Hi there, jalexiscv! 👋 Thank you for sending this PR! We expect the following in all Pull Requests (PRs).
Important We expect all code changes or bug-fixes to be accompanied by one or more tests added to our test suite to prove the code works. If pull requests do not comply with the above, they will likely be closed. Since we are a team of volunteers, we don't have any more time to work Sincerely, the mergeable bot 🤖 |
Fixes codeigniter4#9872 When SiteURIFactory modifies $_GET via setGetArray(), it does not update $_REQUEST. Since IncomingRequest::getVar() reads from $_REQUEST (via fetchGlobal('request')), validation with $validator->withRequest() receives stale data. Changes: - Add Superglobals::syncRequest() method that rebuilds $_REQUEST from $_GET, $_POST, and $_COOKIE respecting PHP's request_order - Call syncRequest() in SiteURIFactory after each setGetArray() call Ref: codeigniter4#9872
9045b60 to
2dddec6
Compare
neznaika0
reviewed
May 18, 2026
neznaika0
left a comment
Contributor
There was a problem hiding this comment.
This has already been discussed. The $_request does not change after the request. The right solution would be to abandon getVar() as deprecated.
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
Fixes #9872 - getVar() behaves inconsistently with GET parameters
Problem
When SiteURIFactory modifies $_GET via setGetArray() during request URI parsing, it does not update $_REQUEST. Since IncomingRequest::getVar() reads from $_REQUEST, validation methods like $validator->withRequest() receive stale data.
Solution
Changes
Testing
Ref: #9872
Closes #9872