diff --git a/www/_include.php b/www/_include.php index a3d64029e8a3b149641d5ce002e0b02ce3e16670..988d937dfead37e91fa4355ca1a6a6aa51d8003d 100644 --- a/www/_include.php +++ b/www/_include.php @@ -22,6 +22,26 @@ if(get_magic_quotes_gpc()) { /* Initialize the autoloader. */ require_once(dirname(dirname(__FILE__)) . '/lib/_autoload.php'); +/* Show error page on unhandled exceptions. */ +function SimpleSAML_exception_handler(Exception $exception) { + $e = new SimpleSAML_Error_Error('UNHANDLEDEXCEPTION', $exception); + $e->show(); +} +set_exception_handler('SimpleSAML_exception_handler'); + +/* Log full backtrace on errors and warnings. */ +function SimpleSAML_error_handler($errno, $errstr, $errfile = NULL, $errline = 0, $errcontext = NULL) { + + /* Show an error with a full backtrace. */ + $e = new SimpleSAML_Error_Exception('Error ' . $errno . ' - ' . $errstr); + $e->logError(); + + /* Resume normal error processing. */ + return FALSE; +} +set_error_handler('SimpleSAML_error_handler'); + + $path_extra = dirname(dirname(__FILE__)) . '/lib';