#28621 [Opn->Bgs]: fgets calls always return false if end-of-file has occured earlier
| From: | iliaa@php.net | Date: | Fri, 04 Jun 2004 13:50:48 +0000 |
| Subject: | #28621 [Opn->Bgs]: fgets calls always return false if end-of-file has occured earlier | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-60362@lists.php.net to get a copy of this message | ||
ID: 28621
Updated by: iliaa@php.net
Reported By: pickett at sumu dot org
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
PHP Version: 4.3.7RC1
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is to be expected.
Previous Comments:
------------------------------------------------------------------------
[2004-06-03 12:02:10] pickett at sumu dot org
Description:
------------
fgets calls will keep returning false if a fd has at some point reached
end-of-file, even though the pointer is no longer at EOF. feof() will
also keep returning true.
Using fread() instead of fgets() works, but is inconvenient if you'd
like to read just one line at a time.
Reproduce code:
---------------
$fdw = fopen("test", "w");
$fdr = fopen("test", "r");
fputs($fdw, "testing 1..\n");
var_dump(fgets($fdr, 0xff));
var_dump(fgets($fdr, 0xff));
fputs($fdw, "testing 2..\n");
var_dump(fgets($fdr, 0xff));
Expected result:
----------------
string(12) "testing 1..
"
bool(false)
string(12) "testing 2..
"
Actual result:
--------------
string(12) "testing 1..
"
bool(false)
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28621&edit=1