cakephp2-php8/lib/Cake/Test/test_app/Error/TestAppsExceptionRenderer.php
Rachman Chavik 07d9a75fcb Helpers in custom CakeErrorController are lost
Since many exceptions do not have its own 'template' file, customized
APP/Controller/CakeErrorController with its own list of helpers could be
ignored.

This happens becase ExceptionRenderer is forced to to use _outputMessageSafe
when a template is missing.  This causes Controller::$helpers to be reset with
default values.
2012-06-01 15:28:06 +07:00

21 lines
599 B
PHP

<?php
class TestAppsExceptionRenderer extends ExceptionRenderer {
protected function _getController($exception) {
App::uses('TestAppsErrorController', 'Controller');
if (!$request = Router::getRequest(true)) {
$request = new CakeRequest();
}
$response = new CakeResponse(array('charset' => Configure::read('App.encoding')));
try {
$controller = new TestAppsErrorController($request, $response);
$controller->layout = 'banana';
} catch (Exception $e) {
$controller = new Controller($request, $response);
$controller->viewPath = 'Errors';
}
return $controller;
}
}