Bug #76107 [NEW]: SplFileInfo returns incorrect information on large file in 32bit architecture
| From: | VeryCrazyDog at gmail dot com | Date: | Sat, 17 Mar 2018 06:45:48 +0000 |
| Subject: | Bug #76107 [NEW]: SplFileInfo returns incorrect information on large file in 32bit architecture | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-214389@lists.php.net to get a copy of this message | ||
From: VeryCrazyDog at gmail dot com
Operating system: Arch Linux ARMv7
PHP version: 7.2.3
Package: SPL related
Bug Type: Bug
Bug description:SplFileInfo returns incorrect information on large file in 32bit architecture
Description:
------------
When calling SplFileInfo::isFile() on a large file, false is returned
instead of true.
When calling SplFileInfo::getMTime() and SplFileInfo::getSize() on a
large file, RuntimeException is throw.
This problem does not happens on Windows 7 64bit running same PHP
version. It seems that it is related the maximum value of int, because
the file size which I used in the test is "2939977728" which cannot be
fit in 32bit OS.
Although it may not be possible to report the file size, it is expected
at least, isFile() and getMTime() should return the correct result.
Test script:
---------------
<?php
$info = new SplFileInfo('/path/to/large_file');
var_dump($info);
var_dump($info->isFile()); // This returns false
var_dump($info->isReadable());
var_dump($info->getMTime()); // This throws RuntimeException
var_dump($info->getSize()); // This throws RuntimeException
if ($info->isFile()) {
echo $info->getRealPath();
}
Expected result:
----------------
vcd@server ~$ php -f test.php
object(SplFileInfo)#1 (2) {
["pathName":"SplFileInfo":private]=>
string(24) "/home/vcd/tmp/large_file"
["fileName":"SplFileInfo":private]=>
string(10) "large_file"
}
bool(true)
bool(true)
int(1515414305)
bool(false)
/home/vcd/tmp/large_file
Actual result:
--------------
vcd@server ~$ php -f test.php
object(SplFileInfo)#1 (2) {
["pathName":"SplFileInfo":private]=>
string(24) "/home/vcd/tmp/large_file"
["fileName":"SplFileInfo":private]=>
string(10) "large_file"
}
bool(false)
bool(true)
PHP Fatal error: Uncaught RuntimeException: SplFileInfo::getMTime():
stat failed for /home/vcd/tmp/large_file in /home/vcd/test.php:6
Stack trace:
#0 /home/vcd/test.php(6): SplFileInfo->getMTime()
#1 {main}
thrown in /home/vcd/test.php on line 6
--
Edit bug report at https://bugs.php.net/bug.php?id=76107&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76107&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76107&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76107&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76107&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76107&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76107&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76107&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76107&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76107&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76107&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76107&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76107&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76107&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76107&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76107&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76107&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76107&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76107&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76107&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76107&r=mysqlcfg