Fix which request is used for error pages.

The most recent request in the request stack should be used,
as it is most likely the request containing an exception.

Fixes incorrect error pages generated inside requestAction() calls.

Fixes #2746
This commit is contained in:
mark_story 2012-04-03 13:24:36 -04:00
parent f09e5a36d2
commit 77f698dbcd

View file

@ -142,7 +142,7 @@ class ExceptionRenderer {
*/
protected function _getController($exception) {
App::uses('CakeErrorController', 'Controller');
if (!$request = Router::getRequest(false)) {
if (!$request = Router::getRequest(true)) {
$request = new CakeRequest();
}
$response = new CakeResponse(array('charset' => Configure::read('App.encoding')));