Edit report at http://bugs.php.net/bug.php?id=54758&edit=1
ID: 54758
User updated by: noodleyman at gmail dot com
Reported by: noodleyman at gmail dot com
Summary: GetSize() returns negative values for large file
sizes
Status: Open
Type: Bug
Package: Directory function related
Operating System: Windows Server 2008
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
just realised I typed the wrong function name in the description by
mistake. it should read "When using GetSize()" not "When using
GetFile()"
Previous Comments:
------------------------------------------------------------------------
[2011-05-16 21:46:57] noodleyman at gmail dot com
Description:
------------
When using GetFile() as documented
http://php.net/manual/en/directoryiterator.getsize.php if you run the
function on a large file you get negative values which are wrong. I
haven't got the exact file size that this happens at, but I have tested
with files of 7GB and over, and always get the same result. tested using
the function in the test script.
Test script:
---------------
function dirSize($directory) {
$size = 0;
foreach(new RecursiveIteratorIterator(new
RecursiveDirectoryIterator($directory)) as $file){
$size+=$file->getSize();
}
return $size;
}
Then ran function using input value of a directory with a single file of
8,510,398,464 bytes in size.
Expected result:
----------------
8310936 KB
Actual result:
--------------
-77674.63
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54758&edit=1