phpbb/phpBB/includes
Nils Adermann a5ef6c3b20 [ticket/10188] Prevent semi-compressed output
When a non-fatal error occurs at the beginning of the script before any custom
error handler is set one of two situations can be encountered:

1) if the ini option output buffer is disabled:
      - headers are sent to the http client
      - the error message is output
2) if the ini option output_buffer is enabled or the script
   is run within an ob_start()/ob_end() wrapper:
      - the error message is written to the output buffer

Once the script reaches page_header() phpbb starts gzip compression if enabled.
This is done through ob_start with a ob_gzhandler as a callback. The
compression is skipped if headers have already been sent. In situation 1) the
error message sent in plain text comes with headers and this gzip compression
is skipped. The client receives a plaintext version of the page. However in
situation 2) headers have not been sent yet and the rest of the page will be
compressed. The result is a plaintext error message followed by compressed
output. The client does not understand this output resulting in either an
error message or simply a blank page in the browser.

In addition to the above situation this problem occurs with errors that are
triggered after the custom error handler is loaded. The problem has been
noticed before, and a workaround was found. The error handler would call
ob_flush() for particular configuration settings before outputting the error
message. This resulted in headers being sent when output buffering was enabled
thus disabling gzip compression for the rest of the page. The constraints under
which ob_flush() was called were lessened over time whenever a new case was
found that would trigger this problem. Eventually ob_flush() would be called
even when code causing an E_NOTICE was simply run within an ob_start/ob_end.
This makes it impossible to use output buffering to retrieve the content of an
error message without prohibiting the page from setting headers afterwards.

This commit removes all flushing in msg_handler completely and instead fixes
the problem for both errors before and after the error handler is registered.
GZIP compression is only enabled if there is at most one level of output
buffering (e.g. the output_buffer php.ini option is enabled) and if there has
not yet been any output in this buffer. This should avoid any partial output
compression.

PHPBB3-10188
2011-06-26 20:31:22 +02:00
..
acm [ticket/10110] Remove multi-server syntax from Redis ACM. 2011-06-11 01:47:50 +02:00
acp [ticket/10221] Append unit (seconds) after input field, remove from explanation 2011-06-16 16:02:34 +02:00
auth [ticket/10220] Limit user agent value length for storage in login attempt table 2011-06-15 18:20:16 +02:00
captcha [ticket/9892] Shorten the index names on the q&a captcha 2011-06-12 01:28:06 +02:00
db [ticket/10214] Correct Oracle create table query syntax in db_tools 2011-06-13 06:14:59 +02:00
diff improve code to detect and solve conflicts for code removed from one version to another. 2009-09-20 16:20:20 +00:00
hooks - fixed database updater 2007-10-04 12:03:05 +00:00
mcp [ticket/10109] Fix "Undefined Index" errors when copying a topic. 2011-04-07 14:53:47 +02:00
questionnaire [Feature] Ability to use HTTP authentication in ATOM feeds by passing the GET parameter auth=http 2010-01-19 19:08:51 +00:00
search [ticket/9595] List min/max characters indexed by search for mysql_fulltext. 2010-10-21 20:31:00 +02:00
ucp [ticket/10158] Remove some code duplication from generating the message. 2011-06-05 01:58:03 +02:00
utf - replaced the drop down menu log filter thing with log searching 2009-08-21 21:47:19 +00:00
.htaccess [ticket/9698] Add .htaccess to the includes subdirectory. 2010-10-15 16:47:21 +02:00
auth.php [ticket/9992] Adding a limit on login attempts per IP. 2011-06-10 12:18:19 +02:00
bbcode.php Merge r10515 into 3.0.7 branch 2010-02-23 16:12:51 +00:00
cache.php [ticket/9933] Move word censor regex into separate function in functions.php 2011-01-07 15:32:34 +01:00
constants.php [prep-release-3.0.9] Bumping version number for 3.0.9-RC2. 2011-06-15 19:41:14 +02:00
error_collector.php [ticket/10057] Fixes for a bunch of small problems. 2011-03-08 19:48:56 -05:00
functions.php [ticket/10188] Prevent semi-compressed output 2011-06-26 20:31:22 +02:00
functions_admin.php [ticket/9874] view_log() performs unneeded count query over all log entries. 2011-02-25 00:04:48 +01:00
functions_compress.php [ticket/7296] Exporting styles to tar creates corrupted archives. 2010-08-22 11:16:19 -04:00
functions_content.php Deprecate $allow_reply parameter to truncate_string() (Bug #56675) 2010-01-25 18:02:37 +00:00
functions_convert.php [ticket/9932] Add the Bing bot when converting 2010-11-29 08:33:10 +01:00
functions_display.php [ticket/9999] Remove broken and unused L_FORUM_FOLDER_ALT variable. 2011-05-09 23:11:56 +02:00
functions_install.php Support for Microsoft's Native SQL Server Driver for PHP - Patch by Chris Pucci at Microsoft [Bug #57055] 2010-02-11 00:02:51 +00:00
functions_jabber.php Fix Jabber SASL PLAIN authentication failures. (Bug #52995) 2009-10-29 15:04:19 +00:00
functions_messenger.php Merge branch 'ticket/cs278/9061' into develop-olympus 2010-10-27 13:06:21 +02:00
functions_module.php [Change] Alllow applications to set custom module inclusion path (idea by HoL) 2008-11-23 12:42:34 +00:00
functions_posting.php Merge branch 'ticket/rxu/6712' into develop-olympus 2011-06-10 00:24:43 +02:00
functions_privmsgs.php Revert "[ticket/7716] Data too long for column 'message_subject'" 2010-08-21 21:25:34 +02:00
functions_profile_fields.php [ticket/10005] Add validation of dropdown custom profile field values 2011-06-02 08:49:59 +02:00
functions_template.php [ticket/10147] Corrected a typo in includes/functions_template.php. 2011-04-23 15:36:45 -04:00
functions_transfer.php Also fix bug #46295 in ftp_fsock class. 2009-07-22 03:02:45 +00:00
functions_upload.php [ticket/9764] Allow $config['mime_triggers'] to be an empty string. 2010-10-28 22:00:04 +02:00
functions_user.php [ticket/10128] Pass E_USER_WARNING to trigger_error() calls from user_ban(). 2011-04-11 00:29:48 +02:00
index.htm Add blank indexes to stop nosey people being, erm, nosey 2001-11-21 13:06:56 +00:00
message_parser.php [ticket/217] Silence errors in tests, not code. 2011-06-06 21:14:10 +08:00
session.php Merge remote-tracking branch 'naderman/ticket/9992' into develop-olympus 2011-06-11 19:40:03 +02:00
startup.php [ticket/7729] Prevent date/time functions from throwing E_WARNING on PHP 5.3. 2011-06-25 17:42:52 +02:00
template.php [ticket/10145] Always recompile all templates when DEBUG_EXTRA is defined. 2011-04-26 12:35:44 +02:00