Bug #54758 [NEW]: GetSize() returns negative values for large file sizes
| From: | noodleyman at gmail dot com | Date: | Mon, 16 May 2011 19:46:58 +0000 |
| Subject: | Bug #54758 [NEW]: GetSize() returns negative values for large file sizes | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-160765@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows Server 2008
PHP version: 5.3.6
Package: Directory function related
Bug Type: Bug
Bug description:GetSize() returns negative values for large file sizes
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 bug report at http://bugs.php.net/bug.php?id=54758&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54758&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54758&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54758&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54758&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54758&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54758&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54758&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54758&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54758&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54758&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54758&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54758&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54758&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54758&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54758&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54758&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54758&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54758&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54758&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54758&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54758&r=mysqlcfg