|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7432 fgetc() is not bin-safe on Windows
Submitted: 2000-10-24 09:50 UTC Modified: 2001-04-27 18:51 UTC
From: i088 at informatik dot fh-wuerzburg dot de Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.0.3pl1 OS: Win9x/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.
Block user comment
Status: Assign to:
Bug Type:
From: i088 at informatik dot fh-wuerzburg dot de
New email:
PHP Version: OS:


 [2000-10-24 09:50 UTC] i088 at informatik dot fh-wuerzburg dot de
If you read a (binary) file character by character with fgetc() you can't read the whole file because you get the EOF before the end of the file. If you try to read the file further with fgetc() you always get the EOF and the variable you read the character into is not set or empty (I don't know which of these, but I think is empty).
This appears in the Windows-version (PWS/isapi-PHP and also
Apache/apache-PHP-module) but not in the Linux-version (Apache/apache-PHP-module DSO).


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-04 12:40 UTC] i088 at informatik dot fh-wuerzburg dot de
I'm very sorry:
fgetc IS bin-safe also on Windows OS, you only have to open the file with fopen(<filename>, "rb") instead of fopen(<filename>, "r"). In PHP3 this don't make a difference but with PHP4 there is this big difference on Windows OS.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jun 12 14:01:35 2024 UTC