Bug #28621 [Com]: fgets calls always return false if end-of-file has occured earlier
| From: | wmy at towntasks dot com | Date: | Fri, 17 Sep 2021 04:18:15 +0000 |
| Subject: | Bug #28621 [Com]: 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-236660@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=28621&edit=1
ID: 28621
Comment by: wmy at towntasks dot com
Reported by: pickett at sumu dot org
Summary: fgets calls always return false if end-of-file has
occured earlier
Status: Not a bug
Type: Bug
Package: Filesystem function related
PHP Version: 4.3.7RC1
Block user comment: N
Private report: N
New Comment:
Hello, If you are searching Fulltime or Partime jobs, you can follow or visit to apply jobs
https://towntasks.com/jobs
https://towntasks.com/employer/freddie-mac
https://towntasks.com/employer/amazon
Previous Comments:
------------------------------------------------------------------------
[2004-06-04 15:50:47] iliaa@php.net
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.
------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=28621&edit=1