Skip to content

Commit 7aa473b

Browse files
Handle more than one level of output buffering when cleaning and ending them so we can send the video file so we don't run out of ram. Fixes #4110
1 parent c294ad0 commit 7aa473b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

web/skins/classic/views/video.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@
7878
unlink($videoFiles[$deleteIndex]);
7979
unset($videoFiles[$deleteIndex]);
8080
} else if (isset($_REQUEST['downloadIndex'])) {
81-
// can't be output buffering, as this file might be large
82-
ob_end_clean();
8381
$downloadIndex = validInt($_REQUEST['downloadIndex']);
8482
ZM\Debug("Download $downloadIndex, file: " . $videoFiles[$downloadIndex]);
8583
header('Pragma: public');
@@ -91,6 +89,11 @@
9189
header('Content-Transfer-Encoding: binary');
9290
header('Content-Type: application/force-download');
9391
header('Content-Length: '.filesize($videoFiles[$downloadIndex]));
92+
// can't be output buffering, as this file might be large
93+
while (ob_get_level()) {
94+
ob_end_clean();
95+
}
96+
set_time_limit(0);
9497
readfile($videoFiles[$downloadIndex]);
9598
exit;
9699
}

0 commit comments

Comments
 (0)