From 3af9846d4ecc1e0274833740fd21012afe9ef51f Mon Sep 17 00:00:00 2001 From: jhunkeler Date: Sun, 20 Dec 2009 20:34:08 +0000 Subject: Error handling functions added, and applied git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@380 c5b2fb0a-d05d-0410-98c8-828840a80ff6 --- includes/functions.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'includes/functions.php') diff --git a/includes/functions.php b/includes/functions.php index cd25792..0203d34 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -322,6 +322,34 @@ function CloseBlock() echo ""; CloseTable(); } + +static $error_stack_messages = array(); //global stack of errors accumulated throughout execution +function push_error_stack($message) +{ + global $error_stack_messages; + array_push($error_stack_messages, $message); +} + +function fatal_error_handler($buffer) { + if (ereg("(error:)(.+)(/","",$regs[2]); + //ReportError($err); + } + return $buffer; +} + +function handle_error ($errno, $errstr, $errfile, $errline) +{ + //error_log("$errstr in $errfile on line $errline"); + //ReportError("
$errstr
"); + push_error_stack("Error Number: $errno
Error: $errstr
In File: $errfile
Line: $errline"); + if($errno == FATAL || $errno == ERROR){ + push_error_stack($errstr); + ob_end_flush(); + exit(0); + } +} + /** * ReportError() * -- cgit