From 3076cf0b6adf2b273a1bc4ec6a57463aab8208f8 Mon Sep 17 00:00:00 2001 From: Anton Grebnev Date: Mon, 4 Jun 2012 16:10:34 +0400 Subject: [PATCH] updated ErrorHandler to check for existing output buffers befor ob_clean --- exception/ErrorHandler.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/exception/ErrorHandler.php b/exception/ErrorHandler.php index b0cfee7..eec155e 100644 --- a/exception/ErrorHandler.php +++ b/exception/ErrorHandler.php @@ -19,9 +19,11 @@ class ErrorHandler static public function error_handler($errno, $errstr, $errfile, $errline) { - ob_clean(); + $ob_handlers = ob_get_status(); + if (!empty($ob_handlers)) { + ob_end_clean(); + } throw new ErrorException($errstr, 0, $errno, $errfile, $errline); - return false; } static protected function getSource($file, $hiline) @@ -71,7 +73,10 @@ class ErrorHandler */ static public function showDebug($exception) { - ob_clean(); + $ob_handlers = ob_get_status(); + if (!empty($ob_handlers)) { + ob_end_clean(); + } $class = get_class($exception); $method = Env::Server('REQUEST_METHOD', '');