Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added check if Router::getRequest(false) is returning a CakeRequest o…

…r null in ExceptionRenderer::_getController(). Fixes 'call to undefined method here()' when having Exceptions raised without valid request set to the Router in testsuite (i.e. undefined database config 'test'). Fixes #1678 .
  • Loading branch information...
commit c71a65530b528709aa630f1f92dff5f21ad3d2e9 1 parent 228230e
@tPl0ch authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/Cake/Error/ExceptionRenderer.php
View
8 lib/Cake/Error/ExceptionRenderer.php
@@ -141,13 +141,17 @@ 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 = new Controller($request);
$controller->viewPath = 'errors';
}
return $controller;
Please sign in to comment.
Something went wrong with that request. Please try again.