Skip to content

Commit

Permalink
Create Sapi.php
Browse files Browse the repository at this point in the history
  • Loading branch information
derkostka authored Jun 11, 2017
1 parent 7d87ae2 commit 059b680
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/Sapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,14 @@ static function sendResponse(ResponseInterface $response) {
if ($contentLength !== null) {
$output = fopen('php://output', 'wb');
if (is_resource($body) && get_resource_type($body) == 'stream') {
while (!feof($body)) {
fwrite($output,fread($body,8192));
if PHP_INT_SIZE != 4){
// use the dedicated function on 64 Bit systems
stream_copy_to_stream($body, $output, $contentLength);
} else {
// workaround for 32 Bit systems to avoid stream_copy_to_stream
while (!feof($body)) {
fwrite($output,fread($body,8192));
}
}
} else {
fwrite($output, $body, (int)$contentLength);
Expand Down

0 comments on commit 059b680

Please sign in to comment.