Index: branches/resourceloader/phase3/includes/WebStart.php |
— | — | @@ -124,10 +124,14 @@ |
125 | 125 | |
126 | 126 | wfProfileIn( 'WebStart.php-ob_start' ); |
127 | 127 | # Initialise output buffering |
128 | | -if ( ob_get_level() ) { |
129 | | - # Someone's been mixing configuration data with code! |
130 | | - # How annoying. |
131 | | -} elseif ( !defined( 'MW_NO_OUTPUT_BUFFER' ) ) { |
| 128 | + |
| 129 | +# Check that there is no previous output or previously set up buffers, because |
| 130 | +# that would cause us to potentially mix gzip and non-gzip output, creating a |
| 131 | +# big mess. |
| 132 | +# In older versions of PHP ob_get_level() returns 0 if there is no buffering or |
| 133 | +# previous output, in newer versions the default output buffer is always set up |
| 134 | +# and ob_get_level() returns 1. In this case we check that the buffer is empty. |
| 135 | +if ( !defined( 'MW_NO_OUTPUT_BUFFER' ) && ( ob_get_level() == 0 || ( ob_get_level() == 1 && ob_get_contents() === '' ) ) ) { |
132 | 136 | require_once( "$IP/includes/OutputHandler.php" ); |
133 | 137 | ob_start( 'wfOutputHandler' ); |
134 | 138 | } |