Browse code

Default exception handler with warning mail to admin

Hanno authored on 05/01/2019 17:16:27
Showing 2 changed files
... ...
@@ -20,6 +20,7 @@ require_once('inc/debug.php');
20 20
 require_once("inc/base.php");
21 21
 require_once("inc/theme.php");
22 22
 
23
+set_exception_handler('handle_exception');
23 24
 
24 25
 $go = $_GET['go'];
25 26
 
... ...
@@ -460,3 +460,9 @@ function get_modules_info()
460 460
     }
461 461
     return $modconfig;
462 462
 }
463
+
464
+function handle_exception($e)
465
+{
466
+    $msg = "Exception caught:\n".$e->getMessage()."\n".serialize($_POST)."\n".serialize($_SERVER);
467
+    mail(config("adminmail"), "Exception on configinterface", $msg);
468
+}