Skip to content

Commit

Permalink
Ensure PSR-7 body->read() is called with an int argument per spec
Browse files Browse the repository at this point in the history
The spec requires that the length argument of the body read method be
an integer, but Slim's implementation causes Content-Length to be
retrieved as a string due to its use of $response->getHeaderLine. This
causes compatibility issues with PSR-7 implementations that use strict
typing, namely zendframework/zend-dictoros 2.0+.
  • Loading branch information
soren121 committed Nov 22, 2018
1 parent 25da5eb commit 52f23a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Slim/App.php
Expand Up @@ -461,7 +461,7 @@ public function respond(ResponseInterface $response)
if (isset($contentLength)) {
$amountToRead = $contentLength;
while ($amountToRead > 0 && !$body->eof()) {
$data = $body->read(min($chunkSize, $amountToRead));
$data = $body->read(min((int)$chunkSize, (int)$amountToRead));
echo $data;

$amountToRead -= strlen($data);
Expand Down

0 comments on commit 52f23a9

Please sign in to comment.