diff options
author | Andreas Fischer <bantu@phpbb.com> | 2011-06-26 20:40:42 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2011-06-26 20:40:42 +0200 |
commit | cabb42790cf28fd14561dd2479409db7502e81a0 (patch) | |
tree | 33837567d4aede7585d2540854cbed3d47da6e2e /phpBB/includes/functions.php | |
parent | Merge branch 'develop-olympus' into develop (diff) | |
parent | Merge branch 'prep-release-3.0.9' into develop-olympus (diff) | |
download | phpbb-cabb42790cf28fd14561dd2479409db7502e81a0.tar.gz phpbb-cabb42790cf28fd14561dd2479409db7502e81a0.tar.bz2 phpbb-cabb42790cf28fd14561dd2479409db7502e81a0.zip |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[ticket/10188] Prevent semi-compressed output
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 932b75d3ac..fda65017d3 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3696,21 +3696,6 @@ function msg_handler($errno, $msg_text, $errfile, $errline) if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false) { - // flush the content, else we get a white page if output buffering is on - if (ob_get_level() > 0) - { - @ob_flush(); - } - - // Another quick fix for those having gzip compression enabled, but do not flush if the coder wants to catch "something". ;) - if (!empty($config['gzip_compress'])) - { - if (@extension_loaded('zlib') && !headers_sent() && !ob_get_level()) - { - @ob_flush(); - } - } - // remove complete path to installation, with the risk of changing backslashes meant to be there $errfile = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $errfile); $msg_text = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $msg_text); @@ -4270,7 +4255,21 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 // gzip_compression if ($config['gzip_compress']) { - if (@extension_loaded('zlib') && !headers_sent()) + // to avoid partially compressed output resulting in blank pages in + // the browser or error messages, compression is disabled in a few cases: + // + // 1) if headers have already been sent, this indicates plaintext output + // has been started so further content must not be compressed + // 2) the length of the current output buffer is non-zero. This means + // there is already some uncompressed content in this output buffer + // so further output must not be compressed + // 3) if more than one level of output buffering is used because we + // cannot test all output buffer level content lengths. One level + // could be caused by php.ini output_buffering. Anything + // beyond that is manual, so the code wrapping phpBB in output buffering + // can easily compress the output itself. + // + if (@extension_loaded('zlib') && !headers_sent() && ob_get_level() <= 1 && ob_get_length() == 0) { ob_start('ob_gzhandler'); } |