diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a626f2..07238bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,6 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- `Stream::create` with a string needs to rewind the created memory stream. - `Psr17Factory::createStreamFromFile`, `UploadedFile::moveTo`, and `UploadedFile::getStream` no longer throw `ValueError` in PHP 8. diff --git a/src/Stream.php b/src/Stream.php index f1dc804..1a7f8c1 100644 --- a/src/Stream.php +++ b/src/Stream.php @@ -71,7 +71,6 @@ public static function create($body = ''): StreamInterface if (\is_string($body)) { $resource = \fopen('php://temp', 'rw+'); \fwrite($resource, $body); - \rewind($resource); $body = $resource; } diff --git a/tests/StreamTest.php b/tests/StreamTest.php index d3ac5aa..f487203 100644 --- a/tests/StreamTest.php +++ b/tests/StreamTest.php @@ -47,7 +47,8 @@ public function testConvertsToString() public function testBuildFromString() { $stream = Stream::create('data'); - $this->assertEquals('data', $stream->getContents()); + $this->assertEquals('', $stream->getContents()); + $this->assertEquals('data', $stream->__toString()); $stream->close(); }