summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRichard de Boer <github@tubul.net>2021-04-10 15:05:18 +0200
committerRichard de Boer <git@tubul.net>2021-05-29 14:14:52 +0200
commit7990f95558ac2b7fac3b9f77dcbdc3c74b05785b (patch)
tree0b7a466daac3d8fb8efb29acf66d362c5c8df452 /lib
parenta0d265b0b1b36e1d560e4c253b6596cdf137f637 (diff)
downloadnextcloud-server-7990f95558ac2b7fac3b9f77dcbdc3c74b05785b.tar.gz
nextcloud-server-7990f95558ac2b7fac3b9f77dcbdc3c74b05785b.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>
Diffstat (limited to 'lib')
-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 a59f735c102..8f4b5db1167 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