[php-src] Issue #10092: Internal stream casting should not emit lost bytes warning twice

From: Date: Tue, 13 Dec 2022 08:30:20 +0000
Subject: [php-src] Issue #10092: Internal stream casting should not emit lost bytes warning twice
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243123@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10092 Author: Girgias ### Description The following code: ```php <?php $handle = fopen('http://example.com', 'r'); var_dump(stream_isatty($handle)); ``` Resulted in this output: ``` Warning: stream_isatty(): 1256 bytes of buffered data lost during stream conversion! in test.php on line 3 Warning: stream_isatty(): 1256 bytes of buffered data lost during stream conversion! in test.php on line 3 bool(false) ``` But I expected this output instead: ``` Warning: stream_isatty(): 1256 bytes of buffered data lost during stream conversion! in test.php on line 3 bool(false) ``` Or ideally: ``` bool(false) ``` The thing is that if one reads the original stream via: ```php $contents = ''; while (!feof($handle)) { $contents .= fread($handle, 8192); } var_dump($contents); ``` 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_

« previous php.bugs (#243123) next »