From:             dsp at tdcspace dot dk
Operating system: w98
PHP version:      4.4.1
PHP Bug Type:     Filesystem function related
Bug description:  cute featue

Description:
------------
I really thought that the feof() was TRUE when the logical file pointer is
a EOF.

but no ! 
we need to do fread() and get an empty record before the feof() reports
TRUE.

sunday is the last day in a week and thus end-of-week - and so is the last
byte a the file is also EOF.

but the way feof() works - is says - it must wait until monday - before it
can find out !


Reproduce code:
---------------
// open and read binary file with 128 byte records

$h = fopen("phpbugs.dat", "rb");

while(!feof($h)) {
  $rec = fread($h, 128);
  if ($strlen($rec) == 0) break; // should not be needed
  }

close($h);


-- 
Edit bug report at http://bugs.php.net/?id=35136&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=35136&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=35136&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=35136&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=35136&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=35136&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=35136&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=35136&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=35136&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=35136&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=35136&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=35136&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=35136&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=35136&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=35136&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=35136&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=35136&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=35136&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=35136&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=35136&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=35136&r=mysqlcfg

Reply via email to