# HG changeset patch # User Dan Fuhry # Date 1290152830 18000 # Node ID 2a5845ef8c1d29ff3b8505008a16d8d376a0bf9c # Parent e8f4dea267c828e31f3bcc2ed45fcc4969e2e83d Some enhancements to the error handler. It replaces out ENANO_ROOT for security, and if the warning is from dbal.php and ENANO_DEBUG is set, prints out a much more verbose message. diff -r e8f4dea267c8 -r 2a5845ef8c1d includes/functions.php --- a/includes/functions.php Fri Nov 19 02:46:14 2010 -0500 +++ b/includes/functions.php Fri Nov 19 02:47:10 2010 -0500 @@ -3239,6 +3239,30 @@ return true; } + // nice little security enhancement + $errfile = str_replace(ENANO_ROOT, '[root]', $errfile); + + // DBAL errors have a different type of debug + if ( preg_match('/^\[root\]\/(repo\/)?includes\/dbal\.php$/', $errfile) && defined('ENANO_DEBUG') ) + { + echo "

DBAL $error_type

"; + echo "

A(n) $error_type was just thrown by the database abstraction layer. $errstr

"; + echo "

Ensure that you are calling \$db->free_result() on all SELECT queries, especially unbuffered ones.

"; + echo "

Undefine ENANO_DEBUG in config.php to ignore this warning. Be warned that a standard PHP $error_type will still be shown.

"; + echo '
';
+		echo preg_replace('/^[^#].+$\n/m', '', enano_debug_print_backtrace(true));
+		echo '
'; + echo "

Query list

"; + global $db; + echo "
" . htmlspecialchars(print_r($db->query_backtrace, true)) . "
"; + exit; + } + + if ( strstr($errstr, "without first fetching all rows from a previous unbuffered query") ) + { + $errstr .= "; define ENANO_DEBUG for a SQL query backtrace and help fixing this."; + } + if ( $do_gzip ) { $php_errors[] = array(