Skip to content

Commit

Permalink
improv: remove cache on 500 error
Browse files Browse the repository at this point in the history
  • Loading branch information
nivcoo authored and Eywek committed Jul 27, 2018
1 parent b698f50 commit 5f07e8b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/Cake/Error/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ public static function handleError($code, $description, $file = null, $line = nu
public static function handleFatalError($code, $description, $file, $line) {
$logMessage = 'Fatal Error (' . $code . '): ' . $description . ' in [' . $file . ', line ' . $line . ']';
CakeLog::write(LOG_ERR, $logMessage);

App::uses('Folder', 'Utility');
$folder = new Folder(ROOT . DS . 'app' . DS . 'tmp' . DS . 'cache');
if (!empty($folder->path)) {
$folder->delete();
}
$exceptionHandler = Configure::read('Exception.handler');
if (!is_callable($exceptionHandler)) {
return false;
Expand All @@ -248,7 +252,7 @@ public static function handleFatalError($code, $description, $file, $line) {
if (ob_get_level()) {
ob_end_clean();
}

if (Configure::read('debug')) {
call_user_func($exceptionHandler, new FatalErrorException($description, 500, $file, $line));
} else {
Expand Down

0 comments on commit 5f07e8b

Please sign in to comment.