php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51380 The function returns one byte less
Submitted: 2010-03-24 13:11 UTC Modified: 2010-03-24 16:13 UTC
From: jatubio at gmail dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.3.2 OS: Windows 2003 Server (IIS 6.0)
Private report: No CVE-ID: None
 [2010-03-24 13:11 UTC] jatubio at gmail dot com
Description:
------------
The function returns one byte less than file size. For example, a file with a 
size 
of 4,268,766 bytes, 4,268,765 bytes returned.

Data:

System	Windows NT 5.2 build 3790 (Windows Server 2003 Standard Edition Service 
Pack 2) i586
Build Date	Mar 3 2010 20:44:33
Compiler	MSVC9 (Visual C++ 2008)
Architecture	x86

Server API	CGI/FastCGI




Test script:
---------------
 $file_size = filesize($path);    // returns one byte less.
 $file_size = filesize($path)+1;    // I need to do this!!


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-24 13:37 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-03-24 13:37 UTC] pajoye@php.net
Can't reproduce it. Tested on 1000 files in various paths and filesystems. And it is pretty obvious as we only return the value given by the windows API.

What do you use for this "bytes returned", which may not be the actual file size.
 [2010-03-24 14:34 UTC] jatubio at gmail dot com
I have checked now and I apologize because the problem was in my code and not in 
function. I'm sorry, I'll try better next time around before writing a bug.

Sorry again.
 [2010-03-24 14:35 UTC] jatubio at gmail dot com
-Status: Feedback +Status: Closed
 [2010-03-24 14:35 UTC] jatubio at gmail dot com
I was one error in my code not in the function. I was one mistake, sorry
 [2010-03-24 16:13 UTC] pajoye@php.net
-Status: Closed +Status: Bogus
 [2013-08-01 19:49 UTC] deomandeo at gmail dot com
Hi, I'm having the same issue...

What was the problem?

I solved it adding 1 byte...

I don't know why this happens...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 18:01:29 2024 UTC