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 = '';