From bfe6be6535ae224639a61dfe84ff681dc5f80364 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 16:35:29 +0900 Subject: [PATCH] Never allow warnings to be printed before headers --- classes/context/Context.class.php | 3 ++- classes/display/DisplayHandler.class.php | 5 ++++- common/framework/debug.php | 5 +---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index 250df2afc..62b5d6ba2 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -329,10 +329,11 @@ class Context } else { - ob_start(); $this->setCacheControl(-1, true); $_SESSION = array(); } + + ob_start(); register_shutdown_function('Context::close'); // set authentication information in Context and session diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index 2f898edf8..f48da0460 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -106,7 +106,10 @@ class DisplayHandler extends Handler } // disable gzip if output already exists - ob_flush(); + while (ob_get_level()) + { + ob_end_flush(); + } if(headers_sent()) { $this->gz_enabled = FALSE; diff --git a/common/framework/debug.php b/common/framework/debug.php index 0196e9d71..0ed9bfb59 100644 --- a/common/framework/debug.php +++ b/common/framework/debug.php @@ -384,10 +384,7 @@ class Debug */ public static function registerErrorHandlers($error_types) { - if (Config::get('debug.enabled')) - { - set_error_handler('\\Rhymix\\Framework\\Debug::addError', $error_types); - } + set_error_handler('\\Rhymix\\Framework\\Debug::addError', $error_types); set_exception_handler('\\Rhymix\\Framework\\Debug::exceptionHandler'); register_shutdown_function('\\Rhymix\\Framework\\Debug::shutdownHandler'); }