Last modified: 2013-01-29 18:48:15 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T33342, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 31342 - OutputHandler is not initialized depending on PHP.ini settings for output buffering
OutputHandler is not initialized depending on PHP.ini settings for output buf...
Status: NEW
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.21.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-04 08:38 UTC by Alex
Modified: 2013-01-29 18:48 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Alex 2011-10-04 08:38:50 UTC
MediaWiki	1.17.0
PHP	5.3.8-1~dotdeb.2 (cgi-fcgi)
MySQL	5.1.58-1~dotdeb.1

In /includes/Webstart.php, starting at line 132:

	# Initialise output buffering
	# Check that there is no previous output or previously set up buffers, because
	# that would cause us to potentially mix gzip and non-gzip output, creating a
	# big mess.
	if ( !defined( 'MW_NO_OUTPUT_BUFFER' ) && ob_get_level() == 0 ) {
		require_once( "$IP/includes/OutputHandler.php" );
		ob_start( 'wfOutputHandler' );
	}


The output handler is not initialized if ob_get_level() != 0. As a consequence, gzip content encoding would not be enabled.

The problem is that ob_get_level() will always return 1 or more if you have output buffering enabled in php.ini (output_buffering is false by default, but PHP suggests a production value of 4096), which means that basically every PHP script starts with ob_start().

One solution to this problem would be to remove the default output buffer early when Mediawiki starts:

	while(ob_get_level() > 0){
	   ob_end_clean();
	}

If this is undesired, and if the conditional check in Webstart is not changed, at the least, mediawiki setup should show a warning notice that with the given output_buffering setting, its output handler (i.e. gzip handler) won't be executed.
Comment 1 Andre Klapper 2013-01-29 18:48:15 UTC
Code has slightly changed /includes/WebStart.php , but still valid in 1.21wmf8:

wfProfileIn( 'WebStart.php-ob_start' );
# Initialise output buffering
# Check that there is no previous output or previously set up buffers, because
# that would cause us to potentially mix gzip and non-gzip output, creating a
# big mess.
if ( !defined( 'MW_NO_OUTPUT_BUFFER' ) && ob_get_level() == 0 ) {
	if ( !defined( 'MW_COMPILED' ) ) {
		require_once( "$IP/includes/OutputHandler.php" );
	}
	ob_start( 'wfOutputHandler' );
}

Similar comments in http://stackoverflow.com/questions/3641598/ob-get-level-starts-at-level-1
Docs: http://php.net/manual/en/function.ob-get-level.php

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links