summaryrefslogtreecommitdiff
path: root/inc/functions.php
diff options
context:
space:
mode:
authorMichael Foster <savetheinternet@tinyboard.org>2013-08-03 00:22:28 -0400
committerMichael Foster <savetheinternet@tinyboard.org>2013-08-03 00:22:28 -0400
commit1d37e81adeea9b2a1bc1028f2bf45b47ac045ec4 (patch)
treed4597976f069d51d25768d0fbd16e586947be655 /inc/functions.php
parent62f8ea4813092b42a2cd390a8358ce798d103f40 (diff)
Better error handling/displaying with $config['debug'] and $config['verbose_errors']
Diffstat (limited to 'inc/functions.php')
-rw-r--r--inc/functions.php16
1 files changed, 14 insertions, 2 deletions
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'];