Closed
Description
Q | A |
---|---|
Bug? | yes |
New Feature? | no |
Version | 1.0.1 |
Actual Behavior
What is the actual behavior?
PHP Fatal error: Uncaught RuntimeException: Unable to perform operation on closed stream in /Users/iconnor/Documents/PHP/php-http-message-bug/vendor/clue/stream-filter/src/functions.php:98
Expected Behavior
What is the behavior you expect?
The stream is rewindable. I should be able to read its contents, rewind it, and then read its contents again.
Steps to Reproduce
Checkout this repository https://github.com/iainconnor/php-http-message-bug/blob/master/demo.php run demo.php.
Or,
$streamFactory = new \Http\Message\StreamFactory\GuzzleStreamFactory();
$stream = $streamFactory->createStream(file_get_contents('http://httpbin.org/gzip'));
$gzipStream = new \Http\Message\Encoding\GzipDecodeStream($stream);
echo $gzipStream->getContents() . PHP_EOL;
if ( $gzipStream->isSeekable() ) {
$gzipStream->rewind();
echo $gzipStream->getContents();
}
Possible Solutions
If you have already ideas how to solve the issue, add them here.
(remove this section if not needed)
These lines -- https://github.com/php-http/message/blob/master/src/Encoding/FilteredStream.php#L116-L118 -- look to be the cause, though I'm not sure on the solution.
Metadata
Metadata
Assignees
Labels
No labels