Skip to content

Conversation

@luzrain
Copy link
Contributor

@luzrain luzrain commented Jun 29, 2025

This merge request fixes a behavioral incompatibility between PsrMessageStream and Psr\Http\Message\StreamInterface.
The read() method incorrectly throw an exception upon reaching the end of the stream. According to the interface contract, it should return an empty string instead. See StreamInterface docs here.
The isReadable() method incorrectly returned false at end of file, whereas it should continue to return true. See the default implementation of GuzzleHttp\Psr7\Stream.php - it stays readable by reaching end of file.

These issues caused compatibility problems with components relying on Psr\Http\Message\StreamInterface - for example, Guzzle's CachingStream fails when used with PsrMessageStream now.

@luzrain luzrain force-pushed the stream_interface_compatibility branch 2 times, most recently from 6af87c2 to 07d5ff4 Compare August 27, 2025 16:13
@luzrain luzrain force-pushed the stream_interface_compatibility branch from 07d5ff4 to deda3d4 Compare August 27, 2025 16:22
@luzrain luzrain changed the title Fix incomplete StreamInterface implementation in PsrMessageStream Fix behavioral incompatibility between PsrMessageStream and StreamInterface Aug 27, 2025
@luzrain
Copy link
Contributor Author

luzrain commented Aug 28, 2025

@kelunik please take a look at this pr when you get a chance.

@luzrain
Copy link
Contributor Author

luzrain commented Nov 5, 2025

@kelunik ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant