|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #10492 fgetc return value (FALSE=EOF ... maybe)
Submitted: 2001-04-25 11:09 UTC Modified: 2001-04-25 11:12 UTC
From: eheckers at users dot sourceforge dot net Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 4.0.4pl1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
35 - 2 = ?
Subscribe to this entry?

 [2001-04-25 11:09 UTC] eheckers at users dot sourceforge dot net
According to the manula fgetc returns value FALSE
if the eof is reached.

This is true but the problem is that it also returns
FALSE if a '0' is read from the file.

The return value FALSE of fgetc() should not be used to test the EOF condition.

It is better to drop that line from the documentation and
add a reference for using feof() to test for the EOF condition.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-25 11:12 UTC]
You need to use === FALSE in this case, to check for the type too. If this is what you are doing, please reopen this bug report and include a short reproducing script.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Sep 19 03:03:37 2021 UTC