diff --git a/lib/base.php b/lib/base.php index 4ff5a43bd249f8739131f874526cdf94e1814917..b4b56267c5635ae83ee293e6c29fc94b116a4742 100644 --- a/lib/base.php +++ b/lib/base.php @@ -317,8 +317,9 @@ class OC{ self::initPaths(); - register_shutdown_function(array('OC_Log', 'onShutdown')); - set_error_handler(array('OC_Log', 'onError' )); + register_shutdown_function(array('OC_Log', 'onShutdown')); + set_error_handler(array('OC_Log', 'onError')); + set_exception_handler(array('OC_Log', 'onException')); // set debug mode if an xdebug session is active if (!defined('DEBUG') || !DEBUG) { diff --git a/lib/log.php b/lib/log.php index 9c754cf60ce9e8e16011accb6cf2fa7f8f02a3ef..17f781fa91c2d8dc5f30527eb9c9c4f1d4c6cd7c 100644 --- a/lib/log.php +++ b/lib/log.php @@ -47,6 +47,11 @@ class OC_Log { return true; } } + + // Uncaught exception handler + public static function onException($exception){ + self::write('PHP', $exception->getMessage() . ' at ' . $exception->getFile() . '#' . $exception->getLine(), self::FATAL); + } //Recoverable errors handler public static function onError($number, $message, $file, $line){