Fixed fatal error handling for php5.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 3 Sep 2008 21:17:08 +0000 (21:17 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 3 Sep 2008 21:17:08 +0000 (21:17 +0000)
includes/errors.inc
includes/session.inc

index 04874a392538a6145ba61e7ea151b5ed43deccea..536d23ad8a50008181d48e2a2b98ab3423eadb3d 100644 (file)
@@ -11,7 +11,6 @@ $msg_colors = array(
 //-----------------------------------------------------------------------------
 //    Error handler - collects all php/user messages for
 //    display in message box.
-// FIX: fatal errors ?
 
 function error_handler($errno, $errstr, $file, $line) {
     global $messages;
@@ -65,6 +64,7 @@ function error_box() {
     echo "<div id='msgbox'>";
     $before_box = ob_get_clean(); // save html content before error box 
 // Necessary restart instead of get_contents/clean calls due to a bug in php 4.3.2
+       register_shutdown_function('ob_end_flush');
     ob_start('output_html');
     echo "</div>";
 }
index 34e01cd214a56260a76802006cd53d6a30fcde6f..9089c693111ead3c2a6a29688c74afb378ddfae4 100644 (file)
@@ -15,9 +15,9 @@
                // Fatal errors are not send to error_handler, 
                // so we must check the output
          if ($text && preg_match('/\bFatal error(<.*?>)?:(.*)/i', $text, $m)) {
-               $Ajax->aCommands = array();  // Don't update page on errors
-               
-               $messages[] = array(E_ERROR, $m[0], null, null);
+               $Ajax->aCommands = array();  // Don't update page via ajax on errors
+               $text = preg_replace('/\bFatal error(<.*?>)?:(.*)/i','', $text);
+               $messages[] = array(E_ERROR, $m[2], null, null);
          }
          $Ajax->run();
          return  in_ajax() ? fmt_errors() : ($before_box.fmt_errors().$text);