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
 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 12:01:28 2024 UTC