ID:               45759
 Updated by:       [EMAIL PROTECTED]
 Reported By:      stuff at axxess dot co dot za
-Status:           Open
+Status:           Bogus
 Bug Type:         Filesystem function related
 Operating System: Linux
 PHP Version:      5.2.6
 New Comment:

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

That is expected, and it is documented:
- http://docs.php.net/feof

Thanks.


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

[2008-08-08 09:44:51] stuff at axxess dot co dot za

Description:
------------
feof(bad_fd) returns FALSE, which indicates that the file descriptor 
has more data.  This is wrong in *every* case.  It should return 
TRUE (no more data), or throw a fatal error.  More than a few sloppy 
fools fail to test the result of fopen(), and blow your bandwidth 
cap and/or hosting budget for a year by serving warnings when your 
RSS source changes their DNS name. 

Reproduce code:
---------------
<?php
$f = fopen ("http://dns.err/foo.html","r";);  # ie. $f=FALSE
while (!feof ($f)) {                         # ie. !feof(FALSE)
  $verse .= fgets($f, 4096);
}
fclose ($f);
echo "DONE";


Expected result:
----------------
Warning: fopen(): php_network_getaddresses: getaddrinfo failed: Name 
or service not known in /home/andrewm/x.php on line 2

Warning: fopen(http://dns.err/foo.html): failed to open stream: No 
such file or directory in /home/andrewm/x.php on line 2

Warning: feof(): supplied argument is not a valid stream resource 
in /home/andrewm/x.php on line 3
DONE

Actual result:
--------------
Warning: fopen(): php_network_getaddresses: getaddrinfo failed: Name 
or service not known in /home/andrewm/x.php on line 2

Warning: fopen(http://dns.err/foo.html): failed to open stream: No 
such file or directory in /home/andrewm/x.php on line 2

Warning: feof(): supplied argument is not a valid stream resource 
in /home/andrewm/x.php on line 3

Warning: fgets(): supplied argument is not a valid stream resource 
in /home/andrewm/x.php on line 4

Warning: feof(): supplied argument is not a valid stream resource 
in /home/andrewm/x.php on line 3

Warning: fgets(): supplied argument is not a valid stream resource 
in /home/andrewm/x.php on line 4

Warning: feof(): supplied argument is not a valid stream resource 
in /home/andrewm/x.php on line 3

Warning: fgets(): supplied argument is not a valid stream resource 
in /home/andrewm/x.php on line 4

Warning: feof(): supplied argument is not a valid stream resource 
in /home/andrewm/x.php on line 3

Warning: fgets(): supplied argument is not a valid stream resource 
in /home/andrewm/x.php on line 4

(warnings continue ad-infinitum)


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


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

Reply via email to