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:
mark_story 2012-08-14 12:43:24 -04:00
parent e183e91b17
commit cdc70fc427

View file

@ -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]);
}