diff --git a/html/index.php b/html/index.php index 1f1e59040a..26e40d9991 100644 --- a/html/index.php +++ b/html/index.php @@ -19,29 +19,23 @@ if (empty($_SERVER['PATH_INFO'])) { } } -function logErrors($errno, $errstr, $errfile, $errline) -{ - global $php_debug; - $php_debug[] = array('errno' => $errno, 'errstr' => $errstr, 'errfile' => $errfile, 'errline' => $errline); -} - -function catchFatal() -{ - $last_error = error_get_last(); - if ($last_error['type'] == 1) { - $log_error = array($last_error['type'],$last_error['message'],$last_error['file'],$last_error['line']); - print_r($log_error); - } -} - if (strpos($_SERVER['REQUEST_URI'], "debug")) { $debug = true; ini_set('display_errors', 0); ini_set('display_startup_errors', 1); ini_set('log_errors', 1); ini_set('error_reporting', E_ALL); - set_error_handler('logErrors'); - register_shutdown_function('catchFatal'); + set_error_handler(function ($errno, $errstr, $errfile, $errline) { + global $php_debug; + $php_debug[] = array('errno' => $errno, 'errstr' => $errstr, 'errfile' => $errfile, 'errline' => $errline); + }); + register_shutdown_function(function () { + $last_error = error_get_last(); + if ($last_error['type'] == 1) { + $log_error = array($last_error['type'], $last_error['message'], $last_error['file'], $last_error['line']); + print_r($log_error); + } + }); $sql_debug = array(); $php_debug = array(); } else {