-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fixes #68948 related to a BC break introduced by #68532 fix. #1578
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
Conversation
Since the 7.0.0 is now out, I'm assuming this issue wasn't considered as major. So now it has been released what can I do to help further and having this old issue fixed ? |
What a mess :) It's difficult for anyone to move on this while the PR isn't generating interest or discussion, what we need is people intimately familiar with streams to come and give us their opinion. I realise it's very late in the day, sorry about that ... What I suggest now is that you start an internals discussion to try to attract some attention for these issues, this should draw out some commentators, and build some kind of consensus on this issue. |
Thank you for the head up @krakjoe I will do that 👍 |
Also ping @sgolemon |
@jails can we know the current status/plan here please ? If you started an internals discussion can you link back to it here. |
@krakjoe sorry I completly forgot about that, just subscribed, validated my email and sent a message explaining the situation to the php.internals mailing list. |
I threw the bottle into the sea, so wait and see. |
The end result of your The reason your tests start passing with this patch seems to do a lot more with the change to
Uh.... that's probably a bug. All open streams should have wrappers. :/ Can you separately create a repro script for that? |
Thanks @sgolemon for the review ! You are totally right, changes on |
@sgolemon could you take another look here please ? |
@krakjoe since all tests are passing maybe we can ship this in the current 7.2 alpha release and see how it's going ? |
@sgolemon @remicollet could you take a look at this one please ? |
any update on this? |
If nobody is comfortable with this part of the codebase maybe the best option is simply to merge this fix so we can move on. This bug worth any other bug and we can't get stuck on it forever imo. |
This is my fault for not paying attention to my github notifications. Yeah, eff it, merging... On my head be it. |
Comment on behalf of pollita at php.net: This will be on 7.2.0RC6 |
This PR is an alternative to #1153 which is a attempt to address #68948 and #68481 without breaking #68532.
Right from start
feof()
on memory based streams didn't work the same way as on file based streams (although it works as expected on HHVM).The following PR changed the memory based streams behavior to solve an eof realted issue. However despite the BC Break, the new introduced behavior was still not consistent with file based streams behavior. And unfortunately there's no way to do so.
Indeed if the current behavior of file based streams is correct, the issue comes from the extrapolation of the eof state from read(). Indeed eof can be safely set to
1
only whenread()
returns0
.So to make it works, this logic requires an extra read which is satisfied by the following condition. Indeed if the number of bytes actually read < size, the loop is executed once more.
read()
will return0
, eof will be set to1
and we are doneBut it's not possible to make other streams to work the same way because of this specific check. However due to the current eof logic this
break
is at least necessary for blocking streams (indeed an extra read will hang the whole process).So either php_stdiop_read can rely on
fread()
and the whole_php_stream_read
&&_php_stream_fill_read_buffer
will need to be refactored according tofeof()
behavior.Or we can switch to greedy reads for all non blocking streams like in the following PR to the make the stream API consistent.
PS:
I noticed that
stream->wrapper
wasnull
for some socket based streams but I have no idea if this "trick" can work for all other blocking streams.