From 91cb3fbdb7104344262e4ba37fc95a13055085ba Mon Sep 17 00:00:00 2001 From: David Wosnitza Date: Sun, 23 Dec 2012 12:22:31 +0100 Subject: [PATCH] added option to clear all opened buffers --- src/php_error.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/php_error.php b/src/php_error.php index fa55cd5..c1dff58 100644 --- a/src/php_error.php +++ b/src/php_error.php @@ -1135,6 +1135,8 @@ public static function identifyTypeHTML( $arg, $recurseLevels=1 ) { private $classNotFoundException; + private $clearAllBuffers; + /** * = Options = * @@ -1229,6 +1231,8 @@ public function __construct( $options=null ) { $this->applicationRoot = ErrorHandler::optionsPop( $options, 'application_root' , $_SERVER['DOCUMENT_ROOT'] ); $this->serverName = ErrorHandler::optionsPop( $options, 'error_reporting_off', $_SERVER['SERVER_NAME'] ); + $this->clearAllBuffers = ErrorHandler::optionsPop( $options, 'clear_all_buffers', false); + /* * Relative paths might be given for document root, * so we make it explicit. @@ -1466,6 +1470,9 @@ private function startBuffer() { * do want it. However otherwise, it will be lost. */ private function discardBuffer() { + if ( $this->clearAllBuffers ) { + while( @ob_end_clean() ); + } $str = $this->bufferOutputStr; $this->bufferOutputStr = '';