PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #27792 [PATCH] Functions fail on large files (filesize,is_file,is_dir,readdir)
Submitted:31 Mar 2004 3:27am UTC Modified: 14 Sep 8:59am UTC
From:kode at kodekrash dot com Assigned to:
Status:Critical Category:Filesystem function related
Version:5.*, 6CVS (2009-04-30) OS:* (LFS)
Votes:230 Avg. Score:4.4 ± 1.0 Reproduced:198 of 204 (97.1%)
Same Version:65 (32.8%) Same OS:95 (48.0%)
View/Vote Add Comment Developer Edit Submission

Have you experienced this issue?
Rate the importance of this bug to you:

[31 Mar 2004 3:27am UTC] kode at kodekrash dot com
Description:
------------
Error:
 (errno=75 - Value too large for defined data type)

Functions:
 is_file
 is_dir
 filesize

Premise:
 size of file is greater than 2GB.

------------------------------------------

I have been able to reproduce this error on 4 different PHP
installations (all on RedHat 7.3 machines), using 12 different files for
each test.

------------------------------------------

This bug has been submitted before, but is marked as BOGUS, which it is
certainly not.

Reproduce code:
---------------
filesize( $fname );
or
is_file( $fname )
or
is_dir( $fname )

where filesize( $fname ) > 2GB

Expected result:
----------------
Function: filesize
Expected: numeric value matching size of file

Function: is_file
Expected: boolean value

Function: is_dir
Expected: boolean value

Actual result:
--------------
(errno=75 - Value too large for defined data type)
[31 Mar 2004 7:14am UTC] wez@php.net
PHP does not currently support LFS.
This is something to be addressed in PHP 5.1
[11 Aug 2005 4:06pm UTC] wez@php.net
Well, looks like it will be fixed in 6.x instead.
[24 Oct 2005 9:16pm UTC] hendersj at mindspring dot com
I have seen problems related to this both over NFS and using a local NSS
filesystem with Novell Open Enterprise Server (Linux kernel, SLES 9 is
where the package orginates).  The problem I have seen is more
accurately described in bug 33872, which was flagged as a duplicate of
this bug.

Bug 33872 describes a condition where readdir() returns only the entries
"." and ".." (in my case just "." is returned) regardless of the
permissions to the directory.  The same code run against a reiserFS
partition works just fine.

I am running php 4.3.4; I have also seen it with PHP 4.2.2 when using an
NFS server that has 64-bit cookie values.
[14 Oct 2007 10:17pm UTC] wez@php.net
You might like to try the following patch:

http://news.php.net/php.internals/32767
[5 Dec 2008 5:28pm UTC] aklmnop at gmail dot com
I had to change a couple more LVAL's to DVAL and RETURN_LONG to 
RETURN_DOUBLE after using the above patch, to make fseek(), fread(), 
ftell() and fwrite() work in PHP 5.2.4. This stuff is way too broken. 
Shamefully broken!
[30 Apr 7:45pm UTC] jani@php.net
See also bug #48099 (NFS mounts misbehave also without the compile 
flags..)
[30 Apr 7:45pm UTC] jani@php.net
And bug #45040
[11 Jul 1:40pm UTC] mail dot pourri at laposte dot net
Please see fix in http://bugs.php.net/bug.php?id=48886
[14 Sep 8:59am UTC] jani@php.net
The latest patch for this:

  http://www.php.net/~wez/lfs.diff
[12 Nov 10:27am UTC] boite dot pour dot spam at gmail dot com
The patch from Wez doesn't work, as it assumes size_t are 64 bits, which
is not the case, even when LFS is defined.

The patch from Mail Pourri works on 5.3.0 (I haven't tested in 5.3.1)

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC