Never allow warnings to be printed before headers

This commit is contained in:
Kijin Sung 2016-02-16 16:35:29 +09:00
parent be83a34b1e
commit bfe6be6535
3 changed files with 7 additions and 6 deletions

View file

@ -329,10 +329,11 @@ class Context
} }
else else
{ {
ob_start();
$this->setCacheControl(-1, true); $this->setCacheControl(-1, true);
$_SESSION = array(); $_SESSION = array();
} }
ob_start();
register_shutdown_function('Context::close'); register_shutdown_function('Context::close');
// set authentication information in Context and session // set authentication information in Context and session

View file

@ -106,7 +106,10 @@ class DisplayHandler extends Handler
} }
// disable gzip if output already exists // disable gzip if output already exists
ob_flush(); while (ob_get_level())
{
ob_end_flush();
}
if(headers_sent()) if(headers_sent())
{ {
$this->gz_enabled = FALSE; $this->gz_enabled = FALSE;

View file

@ -384,10 +384,7 @@ class Debug
*/ */
public static function registerErrorHandlers($error_types) 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'); set_exception_handler('\\Rhymix\\Framework\\Debug::exceptionHandler');
register_shutdown_function('\\Rhymix\\Framework\\Debug::shutdownHandler'); register_shutdown_function('\\Rhymix\\Framework\\Debug::shutdownHandler');
} }