From 6f19c7686ecc9b4bed829a2085430e32364f315c Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Fri, 13 Oct 2017 22:42:39 +0200 Subject: [PATCH] Fixed unhandled exception catching. --- includes/errors.inc | 7 +++++++ includes/session.inc | 1 + 2 files changed, 8 insertions(+) diff --git a/includes/errors.inc b/includes/errors.inc index c5414d60..1a66d96f 100644 --- a/includes/errors.inc +++ b/includes/errors.inc @@ -87,6 +87,13 @@ function error_handler($errno, $errstr, $file, $line) { return true; } + +function exception_handler($exception) +{ + error_handler(E_ERROR, sprintf(_("Unhandled exception [%s]: %s."), $exception->getCode(), $exception->getMessage()), + $exception->getFile(), $exception->getLine()); + end_page(); +} //------------------------------------------------------------------------------ // Formats system messages before insert them into message
// FIX center is unused now diff --git a/includes/session.inc b/includes/session.inc index 3ec67df1..bba6496f 100644 --- a/includes/session.inc +++ b/includes/session.inc @@ -372,6 +372,7 @@ if (isset($_GET['path_to_root']) || isset($_POST['path_to_root'])) include_once($path_to_root . "/includes/errors.inc"); // colect all error msgs set_error_handler('error_handler' /*, errtypes */); +set_exception_handler('exception_handler'); include_once($path_to_root . "/includes/current_user.inc"); include_once($path_to_root . "/frontaccounting.php"); -- 2.30.2