php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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).

Patches

Pull Requests

History

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: Sat Dec 14 02:01:27 2024 UTC