Index: branches/unlabeled/unlabeled-1.59.2/core/kernel/utility/debugger.php =================================================================== diff -u -r5566 -r5629 --- branches/unlabeled/unlabeled-1.59.2/core/kernel/utility/debugger.php (.../debugger.php) (revision 5566) +++ branches/unlabeled/unlabeled-1.59.2/core/kernel/utility/debugger.php (.../debugger.php) (revision 5629) @@ -639,13 +639,13 @@ */ function printReport($returnResult = false, $clean_output_buffer = true) { - $this->profileFinish('script_runtime'); - - $this->breakOutofBuffering(); if ($this->reportDone) { - // don't print same report twice + // don't print same report twice (in case if shutdown function used + compression + fatal error) return ''; } + + $this->profileFinish('script_runtime'); + $this->breakOutofBuffering(); $debugger_start = memory_get_usage(); @@ -731,6 +731,7 @@ if ($skip_reporting) { // let debugger write report and then don't output anything + $this->reportDone = true; return ''; } @@ -773,7 +774,7 @@ if ($returnResult) { $ret = ob_get_contents(); if ($clean_output_buffer) { - ob_clean(); + ob_end_clean(); } $ret .= $this->getShortReport($memory_used); @@ -827,11 +828,10 @@ break; } } - + return '
'.$ret.'
'; } - /** * User-defined error handler * @@ -873,26 +873,27 @@ $this->ProfilerData['error_handling']['ends'] = memory_get_usage(); $this->profilerAddTotal('error_handling', 'error_handling'); if (substr($errorType, 0, 5) == 'Fatal') { - $this->breakOutofBuffering(false); $this->IsFatalError = true; - if (ob_get_level()) ob_flush(); - if (!$this->constOn('DBG_USE_SHUTDOWN_FUNC')) { - $this->printReport(); - } + // append debugger report to data in buffer & clean buffer afterwards + $buffer_content = $this->breakOutofBuffering(false) . $this->printReport(true); + echo $this->constOn('DBG_COMPRESS_OUTPUT') ? gzencode($buffer_content) : $buffer_content; exit; } } function breakOutofBuffering($flush = true) { + $buffer_content = Array(); while (ob_get_level()) { if ($flush) { ob_end_flush(); } else { - ob_end_clean(); + $buffer_content[] = ob_get_clean(); +// ob_end_clean(); } } + return implode('', array_reverse($buffer_content)); } function saveToFile($msg)