From:             duerra at yahoo dot com
Operating system: XP Pro
PHP version:      4.3.3RC1
PHP Bug Type:     Filesystem function related
Bug description:  feof always returns false

Description:
------------
In PHP 4.3.3RC1, feof (Windows) always returns false in the code provided
below, and goes into an endless loop.

Reproduce code:
---------------
$count = 0;
if ($handle = opendir("./"))
{
  while (false !== ($file = readdir($handle)))
  {     
    if(!is_dir($file) AND $file != '.' AND $file !='..' AND $file
!='default' AND (strstr($file, ".php") OR strstr($file, ".htm") OR
strstr($file, ".txt")))
    {
      if(!$open = fopen($file, "r"))
      {
        echo "Could Not Open File";
        exit;
      }
      while(!feof($open))
      {
        $count++;
      }
      fclose($open);
    }   
  }
}
echo $count;

Expected result:
----------------
123456
(or another number)

Actual result:
--------------
Infinite loop once a file is opened (I cut out the test code that I used
to verify that it's actually a bug in order to stay within the 20 line
limit).

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

Reply via email to