Skip to content

Fix implementation of __toString() #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Conversation

mxr576
Copy link

@mxr576 mxr576 commented Mar 14, 2018

"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

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no

What's in this PR?

This is a followup on this bug reported for the client-common package: php-http/client-common#98

mxr576 added 2 commits March 14, 2018 08:10
"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
@xabbuh
Copy link
Member

xabbuh commented Mar 14, 2018

might be a good idea to even add a test for this

@joelwurtz
Copy link
Member

Thanks for this PR.

Problem is that it will always be false, we use a decorator here but we should have implemented directly this interface as a FilteredStream cannot be seekable.

As an example, a deflate stream will build it's deflate "table" (how to decode this string) on the fly, which means reseeking at the begin of the stream will produce a different response if using the same table. (You need to reset the table also)

IMO, the correct way would be to override isSeekable, seek and rewind functions to not allow those method (return false / throw exception), and an optional buffer option on top of plugin using the BufferedStream implementation.

@joelwurtz
Copy link
Member

We can close this if #100 is merged

@dbu
Copy link
Contributor

dbu commented Oct 29, 2018

#100 has been merged

@dbu dbu closed this Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants