aboutsummaryrefslogtreecommitdiff
path: root/includes/functions.php
diff options
context:
space:
mode:
authorjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2009-12-20 15:34:08 -0500
committerjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2009-12-20 15:34:08 -0500
commit3af9846d4ecc1e0274833740fd21012afe9ef51f (patch)
tree2266233bfca1233f2860f3b8a75d453a9513f8c7 /includes/functions.php
parentc0048a6c5a910588be35e30ea96d2b9b335c0503 (diff)
downloadbayonetcms-3af9846d4ecc1e0274833740fd21012afe9ef51f.tar.gz
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
Diffstat (limited to 'includes/functions.php')
-rw-r--r--includes/functions.php28
1 files changed, 28 insertions, 0 deletions
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 "</div>";
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</b>:)(.+)(<br)", $buffer, $regs) ) {
+ $err = preg_replace("/<.*?>/","",$regs[2]);
+ //ReportError($err);
+ }
+ return $buffer;
+}
+
+function handle_error ($errno, $errstr, $errfile, $errline)
+{
+ //error_log("$errstr in $errfile on line $errline");
+ //ReportError("<pre>$errstr</pre>");
+ push_error_stack("<b>Error Number:</b> $errno<br/><b>Error:</b> $errstr<br/><b>In File:</b> $errfile<br/><b>Line:</b> $errline");
+ if($errno == FATAL || $errno == ERROR){
+ push_error_stack($errstr);
+ ob_end_flush();
+ exit(0);
+ }
+}
+
/**
* ReportError()
*