note 124924 rejected from function.feof by cmb
| From: | cmb@php.net | Date: | Fri, 17 Apr 2020 15:13:46 +0000 |
| Subject: | note 124924 rejected from function.feof by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-214492@lists.php.net to get a copy of this message | ||
Note Submitter: valentin at hilbig dot de
----
The manual above is misleading:
"Returns TRUE if the file pointer is at EOF or an error occurs (including socket timeout);
otherwise returns FALSE."
feof(-1) is certainly some form of an error (wrong parameters). But:
<?php
if (feof(-1)===FALSE) echo "wrong!"; else echo "ok";
if (feof(-1)===TRUE) echo "ok"; else echo "wrong!";
?>
outputs "wrong!wrong!"
So the documentation should better read:
"Returns TRUE if EOF has been previously detected on the file pointer (this includes errors
like a socket timeout); In all other cases it returns FALSE (this includes all other types of
errors).