From f0683c2351703b536a292ffce712f6e8c84bac3e Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Wed, 2 Nov 2011 18:03:46 +0000 Subject: [PATCH] (bug 31822) Error during upgrade due to output buffer reset in stdout. 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 | 1 + maintenance/Maintenance.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES-1.18 b/RELEASE-NOTES-1.18 index 4e17e2b1fe..b0bc637b69 100644 --- a/RELEASE-NOTES-1.18 +++ b/RELEASE-NOTES-1.18 @@ -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. diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 67d50cf886..454891f27f 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -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 ) { -- 2.20.1