mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 05:38:52 +00:00
Merge branch 'prep-release-3.0.9' into develop-olympus
* prep-release-3.0.9: [ticket/10188] Prevent semi-compressed output
This commit is contained in:
commit
cdc23a9877
1 changed files with 15 additions and 16 deletions
|
@ -3758,21 +3758,6 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
|
||||||
|
|
||||||
if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false)
|
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
|
// 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);
|
$errfile = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $errfile);
|
||||||
$msg_text = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $msg_text);
|
$msg_text = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $msg_text);
|
||||||
|
@ -4332,7 +4317,21 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
|
||||||
// gzip_compression
|
// gzip_compression
|
||||||
if ($config['gzip_compress'])
|
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');
|
ob_start('ob_gzhandler');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue