From:             pickett at sumu dot org
Operating system: 
PHP version:      4.3.7RC1
PHP Bug Type:     Filesystem function related
Bug description:  fgets calls always return false if end-of-file has occured earlier

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 bug report at http://bugs.php.net/?id=28621&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28621&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28621&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28621&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28621&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28621&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28621&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28621&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28621&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28621&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28621&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28621&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28621&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28621&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28621&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28621&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28621&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28621&r=float

Reply via email to