Closed nicolas-grekas closed 9 months ago
guzzle/psr7 looks OK BTW: https://github.com/guzzle/psr7/blame/2.6/src/Utils.php#L404
laminas/diactoros is affected: https://github.com/laminas/laminas-diactoros/blob/3.4.x/src/Stream.php#L282 /cc @weierophinney
@nicolas-grekas is this a case for which we could write a test in php-http/psr7-integration-tests
so that all PSR-7 implementations could know whether they handle that case properly by running the shared testsuite ? Or is it not testable this way ?
slim/psr7 is affected: https://github.com/slimphp/Slim-Psr7/blob/4299f1650acad6df77fbaeb6f18c59e46af761b9/src/Stream.php#L357 /cc @l0gicgate
ringcentral/psr7 affected too: https://github.com/ringcentral/psr7/blob/360faaec4b563958b673fb52bbe94e37f14bc686/src/Stream.php#L102 /cc @mtdowling
workerman/psr7 affected: https://github.com/walkor/psr7/blob/e21521b72b5a891bd1a7a51376da12801863ce5b/src/Stream.php#L99 /cc @walkor
httpsoft/http-message affected too: https://github.com/httpsoft/http-message/blob/6d86446b9d8f92cc06c60375d3e67cf3407a57a5/src/StreamTrait.php#L332 /cc @devanych
I added a test case at https://github.com/php-http/psr7-integration-tests/pull/74 and updated the implementation to cover more situations (like guzzle does).
Hi @nicolas-grekas, thanks for fixing such a lurking bug! @Nyholm, if possible, when can we expect a release with the fix?
It was released in 1.8.1.
It might also be helpful to have a test case for this in http-factory-tests.
Hi @nicolas-grekas, thanks :+1:
stream_get_contents()
swallows errors. This creates issues like https://github.com/symfony/symfony/issues/52490, where errors reported by the stream layer aren't propagated to user-land.This is even in the C source: https://github.com/php/php-src/blob/311cae03e730c76aed343312319ed8cf1c37ade0/main/streams/streams.c#L1512