php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5645 filesize is always 1 byte short
Submitted: 2000-07-17 15:14 UTC Modified: 2000-07-18 00:50 UTC
From: jandeluyck at gmx dot net Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0.1pl2 OS: FreeBSD / Win32
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: jandeluyck at gmx dot net
New email:
PHP Version: OS:

 

 [2000-07-17 15:14 UTC] jandeluyck at gmx dot net
when calling the following: 
$str_of_file = "blah.txt"; // file is 500bytes
$file = fopen($str_of_file);
fgets($file,filesize($str_of_file)); // i only get the 499 first characters of the file!

So there seems to be a problem.

Tested on Win32 (WinNT 4 / 2000) platforms as on FreeBSD 3.0-RELEASE.

the Win32 binary was the one supplied on the PHP site, running on an Apache 1.3.12.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-18 00:42 UTC] joey at cvs dot php dot net
RTMF, please:


                 string fgets (int fp, int length)

                 Returns a string of up to length - 1 bytes read from the file pointed to by fp. Reading ends when length - 1 bytes have been read
 [2000-07-18 00:50 UTC] sterling at cvs dot php dot net
PS:  fread is what your looking for.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 05:01:31 2024 UTC