php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32095 file_exists() doesn't work with 2G+ files
Submitted: 2005-02-24 18:04 UTC Modified: 2005-03-20 18:09 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: david at giffin dot org Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 5.0.1 OS: Linux Debian
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
2 + 31 = ?
Subscribe to this entry?

 
 [2005-02-24 18:04 UTC] david at giffin dot org
Description:
------------
file_exists() doesn't work under apache with files that are >= 2 gig. The script provided works using the cli version of php5 compilied on the same system at the same time as the apache version.

Reproduce code:
---------------
<?php

print "<pre>";
$file = "/tmp/tester.file";
for ($i = 0; $i < 6; $i++) {
        @unlink($file);
        $cmd = "dd if=/dev/zero of=$file bs=1024 count=1024 seek={$i}M";
        echo $cmd . "\n";
        system($cmd);
        system("ls -lh $file");
        echo "File Exists: " . file_exists($file) . "\n";
        print "\n";
}
@unlink($file);
print "</pre>";

?>

Expected result:
----------------
file_exists should return true even though the file is >= 2 gig

Actual result:
--------------
file_exists returns false if >= 2 gig

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-25 14:26 UTC] sniper@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.



 [2005-03-20 18:09 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2006-03-07 17:03 UTC] steffen dot ryll at siemens dot com
This bug report describes the effect mentioned by "hiro at arkusa dot com" on http://www.php.net/manual/en/function.file-exists.php.

The Problem is, that file_exists($NameOfSomeLargeFile) returns false, if $NameOfSomeLargeFile exists *but is larger than 2 GB*.

In my case, I have backup.tar.gz with size of 6.6 GB.
I expect file_exists("backup.tar.gz") to return true, but it returns false.

System: Solaris 10 on SPARCv9, Apache/2.0.52 (Unix) DAV/2 PHP/5.0.5

I suspect php's limitation of int to 32 bits to be the cause, as filesize("backup.tar.gz") gives me an error, too. (PHP Warning:  filesize(): stat failed for ...)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 17:01:33 2024 UTC