PHP does not have unsigned integers.
In the version which I'm using (v5.2.6-1) it the function "filesize()" reports a negative value for files larger than 2GB.
So, my testfile had 3549599744 Bytes (~3.5GB).
The following code would output a negative number (=the signed value of 3549599744):
ouch: -745367552
Code: Select all
<?php
$filesize = filesize($large_file);
if ($filesize <= 0)
{
printf(
}
else
{
echo "ok!";
}
?>
Since I'm working on a Debian stable (for production usage), I'm stuck with the current PHP version (and I don't even know if this behavior is changed), I had to find a workaround.
Luckily (or actually, unfortunately), others have the same problem and offered infos about workarounds.
so instead of:
Code: Select all
$filesize = filesize($large_file);
Code: Select all
$filesize += sprintf("%u", @filesize($large_file));
But it works...