-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Internal stream casting should not emit lost bytes warning twice #10092
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
Comments
Okay, I have figured why the warning is emitted twice. This warning is not gated by a |
…arning twice) The reason why the warning was emitted is because it was not guarded via the show_err parameter. This parameter is set to false/0 via the macro function php_stream_can_cast() to check this silently. The warning is completely removed as this function in particuliar sets this parameter to 0 when it casts the streamas it "performs a cast" just to retrieve the underlying file number.
I'm a little lost trying to follow the conversation in #10093 and #10173. As an end user of functions like stream_isatty and posix_isatty, I feel like they should never emit such a warning. Who cares what data is lost in conversion as long as the function returns the correct result? How am I supposed to respond to such a warning? I think either the warning should be suppressed, or guidance should be provided on how to resolve it. |
#10173 would fix the warning being displayed, because it indeed makes no sense to display it. |
Fixed via #10173 and the follow-up commits |
I opened a PR to backport this fix to PHP 8.2 but it hasn't gotten any traction, is there some other process to backport this fix? #13821 |
Description
The following code:
Resulted in this output:
But I expected this output instead:
Or ideally:
The thing is that if one reads the original stream via:
One does get the totality of the 1256 bytes of output.
So I'm confused as to why the warning is emitted in the first place.
PHP Version
master
Operating System
No response
The text was updated successfully, but these errors were encountered: