mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Make RequestHandlerComponent better simulate GET requests.
Modify the global state to simulate a GET request. This avoids issues where PUT data would be processed during simulated redirect. Fixes #3113
This commit is contained in:
parent
e183e91b17
commit
cdc70fc427
1 changed files with 2 additions and 0 deletions
|
@ -217,6 +217,7 @@ class RequestHandlerComponent extends Component {
|
|||
|
||||
/**
|
||||
* Handles (fakes) redirects for Ajax requests using requestAction()
|
||||
* Modifies the $_POST and $_SERVER['REQUEST_METHOD'] to simulate a new GET request.
|
||||
*
|
||||
* @param Controller $controller A reference to the controller
|
||||
* @param string|array $url A string or array containing the redirect location
|
||||
|
@ -228,6 +229,7 @@ class RequestHandlerComponent extends Component {
|
|||
if (!$this->request->is('ajax')) {
|
||||
return;
|
||||
}
|
||||
$_SERVER['REQUEST_METHOD'] = 'GET';
|
||||
foreach ($_POST as $key => $val) {
|
||||
unset($_POST[$key]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue