fix: sync $_REQUEST after modifying $_GET in SiteURIFactory#10205
fix: sync $_REQUEST after modifying $_GET in SiteURIFactory#10205jalexiscv 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 See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/pull_request.md 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
left a comment
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.
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