Fix warning "ob_end_flush(): failed to delete and flush buffer" during uploads
authorEdward Chernenko <edwardspec@gmail.com>
Sun, 1 Apr 2018 21:39:59 +0000 (00:39 +0300)
committerKrinkle <krinklemail@gmail.com>
Tue, 22 May 2018 22:09:35 +0000 (22:09 +0000)
Bug: T186565
Change-Id: Ia4b29611ccee4acac11717f5220ff9e0fdbd55a9
(cherry picked from commit 30d72ec3d0914bb905d4114dee9256f02cbdcc7f)

RELEASE-NOTES-1.31
includes/filerepo/FileRepo.php

index abe8e78..a209708 100644 (file)
@@ -143,6 +143,7 @@ production.
 * (T2087, T10897, T87753, T174639) Whitespace created by category and language
   links is now stripped rather than leaving blank lines in odd places.
 * (T3780) Uploads with UTF-8 names now work on PHP7.1+ on Windows servers.
 * (T2087, T10897, T87753, T174639) Whitespace created by category and language
   links is now stripped rather than leaving blank lines in odd places.
 * (T3780) Uploads with UTF-8 names now work on PHP7.1+ on Windows servers.
+* (T186565) Fix PHP Notice from `ob_end_flush()` in `FileRepo::streamFile()`.
 
 === Action API changes in 1.31 ===
 * (T185058) The 'name' value to tgprop for action=query&list=tags has been
 
 === Action API changes in 1.31 ===
 * (T185058) The 'name' value to tgprop for action=query&list=tags has been
index 28021ef..b15f81f 100644 (file)
@@ -1628,7 +1628,11 @@ class FileRepo {
                $status = $this->newGood();
                $status->merge( $this->backend->streamFile( $params ) );
 
                $status = $this->newGood();
                $status->merge( $this->backend->streamFile( $params ) );
 
-               ob_end_flush();
+               // T186565: Close the buffer, unless it has already been closed
+               // in HTTPFileStreamer::resetOutputBuffers().
+               if ( ob_get_status() ) {
+                       ob_end_flush();
+               }
 
                return $status;
        }
 
                return $status;
        }