|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: eheckers at users dot sourceforge dot net
New email:
PHP Version: OS:


 [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: Mon Sep 27 21:03:38 2021 UTC