(bug 31822) Error during upgrade due to output buffer reset in stdout.
authorChad Horohoe <demon@users.mediawiki.org>
Wed, 2 Nov 2011 18:03:46 +0000 (18:03 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Wed, 2 Nov 2011 18:03:46 +0000 (18:03 +0000)
In various places in Maintenance, we're overwriting our output buffer rather than appending to it. This doesn't matter too much in the CLI, but it can corrupt headers when upgrading from the web. Thanks Woozle for pointing this out.

RELEASE-NOTES-1.18
maintenance/Maintenance.php

index 4e17e2b..b0bc637 100644 (file)
@@ -478,6 +478,7 @@ create a page or new section.
   already set above 1024 bytes
 * (bug 32086) Special:PermanentLink now show an error message when no subpage
   was specified.
+* (bug 31822) Error during upgrade due to output buffer reset in stdout
 
 === API changes in 1.18 ===
 * BREAKING CHANGE: action=watch now requires POST and token.
index 67d50cf..454891f 100644 (file)
@@ -310,7 +310,7 @@ abstract class Maintenance {
                if ( $channel === null ) {
                        $this->cleanupChanneled();
 
-                       $f = fopen( 'php://stdout', 'w' );
+                       $f = fopen( 'php://stdout', 'a' );
                        fwrite( $f, $out );
                        fclose( $f );
                }
@@ -331,7 +331,7 @@ abstract class Maintenance {
                if ( php_sapi_name() == 'cli' ) {
                        fwrite( STDERR, $err . "\n" );
                } else {
-                       $f = fopen( 'php://stderr', 'w' );
+                       $f = fopen( 'php://stderr', 'a' );
                        fwrite( $f, $err . "\n" );
                        fclose( $f );
                }
@@ -370,7 +370,7 @@ abstract class Maintenance {
                        return;
                }
 
-               $handle = fopen( 'php://stdout', 'w' );
+               $handle = fopen( 'php://stdout', 'a' );
 
                // End the current line if necessary
                if ( !$this->atLineStart && $channel !== $this->lastChannel ) {