mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Fix exceptions being thrown in beforeFilter breaking error pages.
If an exception was raised in the AppController::beforeFilter(), requests for content-type responses would render as HTML. Extracting the startupProcess() allows us to keep a reference to the error controller, which can be used to force startup RequestHandlerComponent if its enabled. Fixes #3389
This commit is contained in:
parent
e04e0a0ec8
commit
3083b01f7d
2 changed files with 4 additions and 2 deletions
|
@ -66,8 +66,6 @@ class CakeErrorController extends AppController {
|
|||
if ($this->Components->enabled('Security')) {
|
||||
$this->Components->disable('Security');
|
||||
}
|
||||
$this->startupProcess();
|
||||
|
||||
$this->_set(array('cacheAction' => false, 'viewPath' => 'Errors'));
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,11 @@ class ExceptionRenderer {
|
|||
$response = new CakeResponse(array('charset' => Configure::read('App.encoding')));
|
||||
try {
|
||||
$controller = new CakeErrorController($request, $response);
|
||||
$controller->startupProcess();
|
||||
} catch (Exception $e) {
|
||||
if (!empty($controller) && $controller->Components->enabled('RequestHandler')) {
|
||||
$controller->RequestHandler->startup($controller);
|
||||
}
|
||||
}
|
||||
if (empty($controller)) {
|
||||
$controller = new Controller($request, $response);
|
||||
|
|
Loading…
Add table
Reference in a new issue