diff --git a/src/Tracy/Debugger.php b/src/Tracy/Debugger.php index 2c8cccee8..8819f3b75 100644 --- a/src/Tracy/Debugger.php +++ b/src/Tracy/Debugger.php @@ -405,18 +405,18 @@ public static function _exceptionHandler(\Exception $exception, $exit = TRUE) } } - $logMsg = 'Unable to log error. Check if directory is writable and path is absolute.'; if (self::$productionMode) { try { self::log($exception, self::EXCEPTION); } catch (\Exception $e) { } - $error = isset($e) ? $logMsg : NULL; if (self::isHtmlMode()) { + $logged = empty($e); require __DIR__ . '/templates/error.phtml'; } elseif (PHP_SAPI === 'cli') { - fwrite(STDERR, "ERROR: application encountered an error and can not continue.\n$error\n"); + fwrite(STDERR, 'ERROR: application encountered an error and can not continue. ' + . (isset($e) ? "Unable to log error.\n" : "Error was logged.\n")); } } elseif (!connection_aborted() && self::isHtmlMode()) { @@ -434,7 +434,7 @@ public static function _exceptionHandler(\Exception $exception, $exit = TRUE) exec(self::$browser . ' ' . escapeshellarg($file)); } } catch (\Exception $e) { - echo "$exception\n$logMsg {$e->getMessage()}\n"; + echo "$exception\nUnable to log error: {$e->getMessage()}\n"; } } diff --git a/src/Tracy/templates/error.phtml b/src/Tracy/templates/error.phtml index 0b28c309d..6f6aab364 100644 --- a/src/Tracy/templates/error.phtml +++ b/src/Tracy/templates/error.phtml @@ -2,7 +2,7 @@ /** * Default error page. - * @param string $error + * @param bool $logged */ namespace Tracy; @@ -27,5 +27,5 @@ namespace Tracy;

We're sorry! The server encountered an internal error and was unable to complete your request. Please try again later.

-

error 500Tracy says: ", htmlspecialchars($error) ?>

+

error 500
Tracy is unable to log error.

diff --git a/tests/Tracy/Debugger._exceptionHandler.development.console.phpt b/tests/Tracy/Debugger._exceptionHandler.development.console.phpt index 29882ef75..d4bc6f4d7 100644 --- a/tests/Tracy/Debugger._exceptionHandler.development.console.phpt +++ b/tests/Tracy/Debugger._exceptionHandler.development.console.phpt @@ -4,7 +4,7 @@ * Test: Tracy\Debugger::_exceptionHandler() error. * @exitCode 254 * @httpCode 500 - * @outputMatch exception 'Exception' in%A%Unable to log error.%A% + * @outputMatch exception 'Exception' in%A%Unable to log error: %A% */ use Tracy\Debugger; diff --git a/tests/Tracy/Debugger._exceptionHandler.production.html.phpt b/tests/Tracy/Debugger._exceptionHandler.production.html.phpt index 47260a049..fbf9dd62f 100644 --- a/tests/Tracy/Debugger._exceptionHandler.production.html.phpt +++ b/tests/Tracy/Debugger._exceptionHandler.production.html.phpt @@ -4,7 +4,7 @@ * Test: Tracy\Debugger::_exceptionHandler() error. * @exitCode 254 * @httpCode 500 - * @outputMatch %A%Server Error%A%Unable to log error%A% + * @outputMatch %A%Server Error%A%Tracy is unable to log error%A% */ use Tracy\Debugger;