php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40047 stream_eof() return code ignored
Submitted: 2007-01-07 13:01 UTC Modified: 2007-01-20 16:50 UTC
From: alex at kiesel dot name Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.2.0 OS: Gentoo Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: alex at kiesel dot name
New email:
PHP Version: OS:

 

 [2007-01-07 13:01 UTC] 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)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-07 18:21 UTC] 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-15 17:35 UTC] 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-20 16:50 UTC] iliaa@php.net
It is not possible to eliminate those read calls, sorry.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 10 14:01:27 2024 UTC