php.net |  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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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.

Bye,
   Erik.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-25 11:12 UTC] derick@php.net
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-2018 The PHP Group
All rights reserved.
Last updated: Wed Dec 12 07:01:25 2018 UTC