From: Petr Skoda Date: Sat, 31 Oct 2009 14:12:16 +0000 (+0000) Subject: MDL-20577 fixed print error did not work outside of developer mode, output buffer... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=6f8f4d839cdcea782e0e77c286a15a32fb162177;p=moodle.git MDL-20577 fixed print error did not work outside of developer mode, output buffer content not discarded any more (significant debugging regression fix) --- diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 3d8c8c4055..7015546b50 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -715,7 +715,6 @@ class moodle_core_renderer extends moodle_renderer_base { $header = $this->doctype() . $header; } - send_headers($this->contenttype, $this->page->cacheable); $this->opencontainers->push('header/footer', $footer); @@ -1059,7 +1058,7 @@ class moodle_core_renderer extends moodle_renderer_base { */ public function link($link, $text=null) { global $CFG; - + $attributes = array(); if (is_a($link, 'html_link')) { @@ -1917,10 +1916,7 @@ class moodle_core_renderer extends moodle_renderer_base { public function fatal_error($message, $moreinfourl, $link, $backtrace, $debuginfo = null) { $output = ''; - - if (!debugging('', DEBUG_DEVELOPER)) { - return false; - } + $obbuffer = ''; if ($this->has_started()) { // we can not always recover properly here, we have problems with output buffering, @@ -1932,9 +1928,9 @@ class moodle_core_renderer extends moodle_renderer_base { // because the buffered text would be printed before our start of page. // NOTE: this hack might be behave unexpectedly in case output buffering is enabled in PHP.ini while (ob_get_level() > 0) { - ob_end_clean(); + $obbuffer .= ob_get_clean(); } - + // Header not yet printed if (isset($_SERVER['SERVER_PROTOCOL'])) { // server protocol should be always present, because this render @@ -1952,12 +1948,16 @@ class moodle_core_renderer extends moodle_renderer_base { get_string('moreinformation') . '

'; $output .= $this->box($message, 'errorbox'); - if (!empty($debuginfo)) { - $output .= $this->notification($debuginfo, 'notifytiny'); - } - if (!empty($backtrace)) { - $output .= $this->notification('Stack trace: ' . - format_backtrace($backtrace), 'notifytiny'); + if (debugging('', DEBUG_DEVELOPER)) { + if (!empty($debuginfo)) { + $output .= $this->notification('Debug info: '.s($debuginfo), 'notifytiny'); + } + if (!empty($backtrace)) { + $output .= $this->notification('Stack trace: '.format_backtrace($backtrace), 'notifytiny'); + } + if ($obbuffer !== '' ) { + $output .= $this->notification('Output buffer: '.s($obbuffer), 'notifytiny'); + } } if (!empty($link)) {