We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d9afb27 commit af9fbb3Copy full SHA for af9fbb3
BinaryFileResponse.php
@@ -342,13 +342,19 @@ public function sendContent()
342
$length = $this->maxlen;
343
while ($length && !feof($file)) {
344
$read = $length > $this->chunkSize || 0 > $length ? $this->chunkSize : $length;
345
- $read = stream_copy_to_stream($file, $out, $read);
346
347
- if (false === $read || connection_aborted()) {
+ if (false === $data = fread($file, $read)) {
348
break;
349
}
350
- if (0 < $length) {
351
- $length -= $read;
+ while ('' !== $data) {
+ $read = fwrite($out, $data);
+ if (false === $read || connection_aborted()) {
352
+ break;
353
+ }
354
+ if (0 < $length) {
355
+ $length -= $read;
356
357
+ $data = substr($data, $read);
358
359
360
0 commit comments