(bug 34254) fix gzipped file cache double compressing output
authorAntoine Musso <hashar@users.mediawiki.org>
Thu, 9 Feb 2012 11:02:36 +0000 (11:02 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Thu, 9 Feb 2012 11:02:36 +0000 (11:02 +0000)
A gzipped file cache is enabled by setting $wgUseGzip and $wgUseFileCache.
To save CPU cycles, HTMLFileCache would print the compressed output as is
but WebStart uses an ob_gzhandler so we end up with a double compression.

RELEASE-NOTES-1.20
includes/Setup.php

index 6fedda9..1f6a1fc 100644 (file)
@@ -18,6 +18,8 @@ production.
 * (bug 30245) Use the correct way to construct a log page title.
 * (bug 34237) Regenerate an empty user_token and save to the database
   when we try to set the user's cookies for login.
+* (bug 34254) Using a gzipped file cache ($wgUseGzip and $wgUseFileCache)
+  compressed the output twice resulting in garbage output (since 1.18)
 
 === API changes in 1.20 ===
 
index 1e0ab0b..1cf171a 100644 (file)
@@ -388,6 +388,12 @@ if ( $wgCanonicalServer === false ) {
        $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP );
 }
 
+if ( $wgUseFileCache && $wgUseGzip ) {
+       // Bypass any previous output handler to avoid double
+       // compression (bug 34254)
+       wfResetOutputBuffers();
+}
+
 wfProfileIn( $fname . '-misc1' );
 
 # Raise the memory limit if it's too low