Fixing ExceptionRenderer initializing Controllers with no request set. #73

Closed
wants to merge 5 commits into
from
View
2 lib/Cake/Controller/CakeErrorController.php
@@ -26,7 +26,7 @@ function __construct($request = null) {
parent::__construct($request);
$this->constructClasses();
$this->Components->trigger('initialize', array(&$this));
- $this->_set(array('cacheAction' => false, 'viewPath' => 'errors'));
+ $this->_set(array('cacheAction' => false, 'viewPath' => 'Errors'));
}
/**
View
10 lib/Cake/Error/ExceptionRenderer.php
@@ -141,14 +141,18 @@ function __construct(Exception $exception) {
*
* @param Exception $exception The exception to get a controller for.
* @return Controller
+ * @access protected
*/
protected function _getController($exception) {
App::uses('CakeErrorController', 'Controller');
+ if(!$request = Router::getRequest(false)) {
+ $request = new CakeRequest();
+ }
try {
- $controller = new CakeErrorController(Router::getRequest(false));
+ $controller = new CakeErrorController($request);
} catch (Exception $e) {
- $controller = new Controller(Router::getRequest(false));
- $controller->viewPath = 'errors';
+ $controller = new Controller($request);
+ $controller->viewPath = 'Errors';
}
return $controller;
}