Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8198830

Browse filesBrowse files
[HttpFoundation] Fix BinaryFileResponse
1 parent a839bec commit 8198830
Copy full SHA for 8198830

File tree

1 file changed

+10
-4
lines changed
Filter options

1 file changed

+10
-4
lines changed

‎src/Symfony/Component/HttpFoundation/BinaryFileResponse.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/BinaryFileResponse.php
+10-4Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,13 +342,19 @@ public function sendContent()
342342
$length = $this->maxlen;
343343
while ($length && !feof($file)) {
344344
$read = $length > $this->chunkSize || 0 > $length ? $this->chunkSize : $length;
345-
$read = stream_copy_to_stream($file, $out, $read);
346345

347-
if (false === $read || connection_aborted()) {
346+
if (false === $data = fread($file, $read)) {
348347
break;
349348
}
350-
if (0 < $length) {
351-
$length -= $read;
349+
while ('' !== $data) {
350+
$read = fwrite($out, $data);
351+
if (false === $read || connection_aborted()) {
352+
break;
353+
}
354+
if (0 < $length) {
355+
$length -= $read;
356+
}
357+
$data = substr($data, $read);
352358
}
353359
}
354360

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.