ID:               28273
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mikeboulet at newfangled dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Filesystem function related
 Operating System: Redhat 7.2 or Redhat AS 2.1
 PHP Version:      4.3.4
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

feof() does exactly what it's supposed to. 


Previous Comments:
------------------------------------------------------------------------

[2004-05-04 15:58:52] mikeboulet at newfangled dot com

Description:
------------
When a fopen() is done on a file that has permissions that are set to
not allow the current process user to read it or the file doesn't exist
it returns false. This is expected. The problem is when feof() is fed
the invalid handle it doesn't return TRUE() thus creating an infinite
loop in the following code example. 


Reproduce code:
---------------
<?php
$fp = fopen( 't.txt', 'r' );

while( !feof( $fp ) )
{
    print fgets( $fp );
}

fclose( $fp );
?>

Expected result:
----------------
feof() would return TRUE to cancel the loop and the script would end.
There would of course be warnings because of the invalid file handle,
but that is expected.

There should be better error handling on the developers part and catch
the invalid file handle, but I would expect the file functions to
handle this situation accordingly.

Actual result:
--------------
Inifinite loop


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=28273&edit=1

Reply via email to