From 52f23a9eabae37abffb8e94d7dc1df66b04ca014 Mon Sep 17 00:00:00 2001 From: Nicholas Narsing Date: Wed, 21 Nov 2018 16:25:22 -0800 Subject: [PATCH] Ensure PSR-7 body->read() is called with an int argument per spec 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+. --- Slim/App.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Slim/App.php b/Slim/App.php index 7db72b758..56184cc72 100644 --- a/Slim/App.php +++ b/Slim/App.php @@ -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);