From a9d31b0380035898e9eb949220b9fa70af12ca10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dezs=C5=91=20BICZ=C3=93?= Date: Wed, 14 Mar 2018 08:10:28 +0100 Subject: [PATCH 1/2] Fix implementation of __toString() "This method MUST attempt to seek to the beginning of the stream before reading data and read the stream until the end is reached." https://github.com/php-fig/http-message/blob/master/src/StreamInterface.php#L28 --- src/Encoding/FilteredStream.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Encoding/FilteredStream.php b/src/Encoding/FilteredStream.php index 4b296ed..930c478 100644 --- a/src/Encoding/FilteredStream.php +++ b/src/Encoding/FilteredStream.php @@ -151,6 +151,9 @@ public function getSize() */ public function __toString() { + if ($this->stream->isSeekable()) { + $this->stream->rewind(); + } return $this->getContents(); } From b87206c423a4091297f84362ac4ddc1358225d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dezs=C5=91=20BICZ=C3=93?= Date: Wed, 14 Mar 2018 08:21:38 +0100 Subject: [PATCH 2/2] CS fix. --- src/Encoding/FilteredStream.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Encoding/FilteredStream.php b/src/Encoding/FilteredStream.php index 930c478..7ac4b75 100644 --- a/src/Encoding/FilteredStream.php +++ b/src/Encoding/FilteredStream.php @@ -154,6 +154,7 @@ public function __toString() if ($this->stream->isSeekable()) { $this->stream->rewind(); } + return $this->getContents(); }