summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard de Boer <github@tubul.net>2021-04-10 15:05:18 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2021-06-07 21:33:53 +0000
commit9f3824b8843d541108813b3110356a047adc8492 (patch)
tree81788e0e1b7748d9d09e750d405789e12975652f
parent088118f54867cc57d160d0e9a9a4582159af5c98 (diff)
downloadnextcloud-server-9f3824b8843d541108813b3110356a047adc8492.tar.gz
nextcloud-server-9f3824b8843d541108813b3110356a047adc8492.zip
Check whether output buffering is active before turning it off
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>
-rw-r--r--lib/private/Files/View.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index ed7d6c26318..4785fd02b50 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -422,7 +422,9 @@ class View {
*/
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
@@ -446,7 +448,9 @@ class View {
*/
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