Fixed unhandled exception catching.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 13 Oct 2017 20:42:39 +0000 (22:42 +0200)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 29 Oct 2017 12:05:02 +0000 (13:05 +0100)
includes/errors.inc
includes/session.inc

index c5414d60b92b26aca3d27fa8b641a5b7c2fd7421..1a66d96f701525780a0d9eddd29f32e2f17f86e9 100644 (file)
@@ -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 <div>
 // FIX center is unused now
index 3ec67df1be0134276def5c0b1ad0f0539f5478a0..bba6496fddd1dc6a861c9db4b149cf63aabe734b 100644 (file)
@@ -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");