Index: branches/5.1.x/core/kernel/application.php =================================================================== diff -u -N -r13454 -r13471 --- branches/5.1.x/core/kernel/application.php (.../application.php) (revision 13454) +++ branches/5.1.x/core/kernel/application.php (.../application.php) (revision 13471) @@ -1,6 +1,6 @@ HandleEvent( new kEvent('adm:OnBeforeShutdown') ); - if (defined('DEBUG_MODE') && $this->isDebugMode() && constOn('DBG_PROFILE_MEMORY')) { + $debug_mode = defined('DEBUG_MODE') && $this->isDebugMode(); + + if ($debug_mode && constOn('DBG_PROFILE_MEMORY')) { $this->Debugger->appendMemoryUsage('Application before Done:'); } - if (defined('DEBUG_MODE') && $this->isDebugMode()) { + if ($debug_mode) { $this->EventManager->RunRegularEvents(reAFTER); $this->Session->SaveData(); @@ -1069,23 +1071,26 @@ $this->HTML = ob_get_clean() . $this->HTML . $this->Debugger->printReport(true); } else { - $this->HTML = ob_get_clean().$this->HTML; + $this->HTML = ob_get_clean() . $this->HTML; } if ($this->UseOutputCompression()) { - header('Content-Encoding: gzip'); $compression_level = $this->ConfigValue('OutputCompressionLevel'); - if ($compression_level < 0 || $compression_level > 9) $compression_level = 7; + if ($compression_level < 0 || $compression_level > 9) { + $compression_level = 7; + } + + header('Content-Encoding: gzip'); echo gzencode($this->HTML, $compression_level); } else { echo $this->HTML; } $this->UpdateCache(); - flush(); - if (!$this->isDebugMode()) { + + if (!$debug_mode) { $this->EventManager->RunRegularEvents(reAFTER); $this->Session->SaveData(); }