updated ErrorHandler to check for existing output buffers befor ob_clean

This commit is contained in:
Anton Grebnev
2012-06-04 16:10:34 +04:00
parent 950d1f4a9a
commit 3076cf0b6a

View File

@ -19,9 +19,11 @@ class ErrorHandler
static public function error_handler($errno, $errstr, $errfile, $errline) 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); throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
return false;
} }
static protected function getSource($file, $hiline) static protected function getSource($file, $hiline)
@ -71,7 +73,10 @@ class ErrorHandler
*/ */
static public function showDebug($exception) static public function showDebug($exception)
{ {
ob_clean(); $ob_handlers = ob_get_status();
if (!empty($ob_handlers)) {
ob_end_clean();
}
$class = get_class($exception); $class = get_class($exception);
$method = Env::Server('REQUEST_METHOD', ''); $method = Env::Server('REQUEST_METHOD', '');