From 1d37e81adeea9b2a1bc1028f2bf45b47ac045ec4 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sat, 3 Aug 2013 00:22:28 -0400 Subject: Better error handling/displaying with $config['debug'] and $config['verbose_errors'] --- inc/functions.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'inc/functions.php') diff --git a/inc/functions.php b/inc/functions.php index f000dc3c..b6bdd809 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -155,10 +155,22 @@ function loadConfig() { } if ($config['verbose_errors']) { + set_error_handler(function($errno, $errstr, $errfile, $errline) { + if (error_reporting() == 0) + return false; // Looks like this warning was suppressed by the @ operator. + error(utf8tohtml($errstr), true, array( + 'file' => $errfile, + 'line' => $errline, + 'errno' => $errno, + 'error' => $errstr, + 'backtrace' => array_slice(debug_backtrace(), 1) + )); + }); error_reporting(E_ALL); - ini_set('display_errors', 1); + ini_set('display_errors', true); + ini_set('html_errors', false); } - + // Keep the original address to properly comply with other board configurations if (!isset($__ip)) $__ip = $_SERVER['REMOTE_ADDR']; -- cgit v1.3