#20446 [Bgs]: negative filesize() returned on large files > 2Gb
| From: | andrew dot robinson at gni dot co dot uk | Date: | Fri, 15 Nov 2002 16:09:12 +0000 |
| Subject: | #20446 [Bgs]: negative filesize() returned on large files > 2Gb | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-24988@lists.php.net to get a copy of this message | ||
ID: 20446
User updated by: andrew.robinson@gni.co.uk
Reported By: andrew.robinson@gni.co.uk
Status: Bogus
Bug Type: *Directory/Filesystem functions
Operating System: NT4 - SP 6
PHP Version: 4.2.3
New Comment:
Although the number is no longer negative the size is unfortunately
inaccurate by quite a bit. It's a shame as php was in the running as
our cli for scripting on NT. I doubt it will pass acceptance testing
now.
Thanks for all your help it was appreciated.
Regards
Andy
Previous Comments:
------------------------------------------------------------------------
[2002-11-15 09:33:41] iliaa@php.net
You could try doing:
printf("%u", filesize("your_file"));
------------------------------------------------------------------------
[2002-11-15 09:30:28] andrew.robinson@gni.co.uk
disk_total_space() appears to cope very well with large volumes
(100Gb+). Are there any work arounds for filesize() ?
------------------------------------------------------------------------
[2002-11-15 09:26:17] derick@php.net
This is not really a bug, PHP simply doesn't support unsigned integers,
and a signed integer on Windows/i386 only goes to 2^31 - 1 (about
2GB).
Ddderick
------------------------------------------------------------------------
[2002-11-15 09:23:22] andrew.robinson@gni.co.uk
the following works fine on small files (<2Gb) but returns negative
numbers for files larger.
while ( $file = readdir($dp) ){
clearstatcache();
if (! ereg("^[.]+$|^$",$file) ){
$stats = stat("$DIRNAME$file");
echo "$DIRNAME$file\t" . $stats[7] . "\t" filesize("$DIRNAME$file")
.
"\n";
}
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20446&edit=1