#40047 [Opn->Bgs]: stream_eof() return code ignored
| From: | iliaa@php.net | Date: | Sat, 20 Jan 2007 16:50:41 +0000 |
| Subject: | #40047 [Opn->Bgs]: stream_eof() return code ignored | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-107823@lists.php.net to get a copy of this message | ||
ID: 40047
Updated by: iliaa@php.net
Reported By: alex at kiesel dot name
-Status: Open
+Status: Bogus
Bug Type: Streams related
Operating System: Gentoo Linux
PHP Version: 5.2.0
New Comment:
It is not possible to eliminate those read calls, sorry.
Previous Comments:
------------------------------------------------------------------------
[2007-01-15 17:35:33] alex at kiesel dot name
Sorry, it really doesn't matter what stream_eof() returns; subsequent
calls to stream_read() are being done regardless of its return value.
Removing the function isn't possible as it is a required stream
function. Due to performance reasons, one might want to save those
calls to stream_eof() (or the last stream_read() call), though.
------------------------------------------------------------------------
[2007-01-07 18:21:42] iliaa@php.net
The return value of the function is most definitely not
ignored. The internal streams IO requires the additional read,
hence the 2nd call.
------------------------------------------------------------------------
[2007-01-07 13:01:44] alex at kiesel dot name
Description:
------------
When reading through a stream wrapper, the method stream_eof() is
called, but it's result is discarded and ignored.
This leads to an obsolete call to stream_read().
Reproduce code:
---------------
http://kiesel.name/php/stream.phps
Expected result:
----------------
string(11) "stream_stat"
string(43) "stream_read(8192) / 80 / returning 80 bytes"
string(14) "stream_eof(): "
bool(true)
Actual result:
--------------
string(11) "stream_stat"
string(43) "stream_read(8192) / 80 / returning 80 bytes"
string(14) "stream_eof(): "
bool(true)
string(42) "stream_read(8192) / 80 / returning 0 bytes"
string(14) "stream_eof(): "
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40047&edit=1