-
Notifications
You must be signed in to change notification settings - Fork 41
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
Filtered Stream is not seekable #100
Conversation
Could you elaborate why filtered streams are not seekable? |
Because the transformation of filtering stream is done with a "pipe" to ensure there is no memory problem, so nothing is keeped from the previous stream. Making it seekable would force us to retain that 4 chars filtered equals to X chars not filtered and vice versa, and this is not done actually. |
Okey. Im 👍 |
Yes we need to sync both streams to make it works, and it's really difficult and prone to many errors, where using a BufferedStream is a really simple thing that can be add on top of this to allow seeking |
Any news on this? |
This is currently a BC breaking change. Everyone extending the |
My understanding is that it is a bug fix, because seeking a filtered stream wasn't safe in the first place. I guess we can revert the change, but that will leave the original problem unsolved. @joelwurtz what do you think? |
I think that the best option would be to use |
oh, did it previously silently not work? i understood that it failed. then indeed, version one should |
i would consider returning |
Well, as far as I can tell it at least returned something, that in some cases may have been correct, but using it is certainly unsafe. Returning false would probably work if this class wasn't used as a parent class. Otherwise this change would be perfectly fine IMHO, since one should not rely on specific behaviour, but an interface instead which allows returning false and throwing an exception. |
For me it's BC since we strictly follow PSR7 here: you should always check if the stream is seekable if you want to rewind it. Since we are returning false, you should not use the rewind function, and use some sort of buffer. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
i think we are on a thin line of BC here, where things might have accidentally worked before (when rewind was not necessary). to avoid troubles for consumers, i would prefer to only keep the change to false, but |
It looks like that would cause less harm at this point, but still leaves the previous issue open. :\ @joelwurtz would you mind opening a PR that reverts the change? |
see #104 |
fixed in 1.7.2 |
Thanks @dbu |
Filtered Stream is not seekable, previously we would rely on the inner stream, but it was a mistake.