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>
This commit is contained in:
parent
a0d265b0b1
commit
7990f95558
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue