Skip to content

Commit

Permalink
Check whether output buffering is active before turning it off
Browse files Browse the repository at this point in the history
Before we just turned it off and @Suppressed the error if ob was not active.
In PHP 8 this error is no longer suppressed, so try to not cause it at all.

Signed-off-by: Richard de Boer <git@tubul.net>
  • Loading branch information
rigrig authored and backportbot[bot] committed Jun 7, 2021
1 parent 088118f commit 9f3824b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/private/Files/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@ public function filesize($path) {
*/
public function readfile($path) {
$this->assertPathLength($path);
@ob_end_clean();
if (ob_get_level()) {
ob_end_clean();
}
$handle = $this->fopen($path, 'rb');
if ($handle) {
$chunkSize = 524288; // 512 kB chunks
Expand All @@ -446,7 +448,9 @@ public function readfile($path) {
*/
public function readfilePart($path, $from, $to) {
$this->assertPathLength($path);
@ob_end_clean();
if (ob_get_level()) {
ob_end_clean();
}
$handle = $this->fopen($path, 'rb');
if ($handle) {
$chunkSize = 524288; // 512 kB chunks
Expand Down

0 comments on commit 9f3824b

Please sign in to comment.