php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #21102 stat, lstat to support 64 bit variants when available
Submitted: 2002-12-19 18:52 UTC Modified: 2005-08-11 19:43 UTC
Votes:3
Avg. Score:3.7 ± 1.2
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: bonebakker at attbi dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.4.0-dev OS: any with large file support
Private report: No CVE-ID: None
 [2002-12-19 18:52 UTC] bonebakker at attbi dot com
<?php
if (is_file("/tmp/very_large_file")) {
	echo "is file";
} else {
        echo "is not";
}
?>
~

if the file /tmp/very_large_file is larger than 2 GB, php reports the error:

Warning: stat failed for /tmp/very_large_file (errno=79 - Value too large for defined data type)


php_4.2.3 is compiled as an apache_1.3.27 module




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-22 00:55 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2003-01-09 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2003-01-11 20:10 UTC] bonebakker at attbi dot com
[unable to edit bug report]

latest CVS tarball does not fix the bug, example still fails with latest release.
 [2003-01-11 20:49 UTC] philip@php.net
Updating -> 4.4.0-dev / open
 [2003-01-11 21:35 UTC] pollita@php.net
What version of Solaris are you running?

Many unixes (even current ones) use a signed int (32-bit) for the st_size element of the stat struct used by their c-library's stat() function.

Try taking a look in stat.h and/or types.h if you'd like to confirm this on your local system.

Does the stat command (from the shell) return sensible output when run against this file?
 [2003-01-12 18:22 UTC] bonebakker at attbi dot com
Current OS is Solaris 9u1, 64 bit kernel.
Checking types.h and stat.h indicates that Solaris uses an off_t type for the stat structure. off_t is either a long,  or a longlong_t, defined as long long.

It seems to me that the stat structure in Solaris has the correct type. This is also indicated by the fact that I can use the stat(2) functions to stat the file in a simple C-program without any errors (and get the correct file size), 
Solaris does not have a shell stat command (AFAIK).
 [2003-01-12 19:01 UTC] wez@php.net
PHP does not support 64-bit stat'ing.
Additionally, PHP only supports signed 32-bit integers (unless your CPU is 64-bit native).
PHP could return large file sizes as floating point numbers, but the infrastructure for 64 bit stat is not in place at this time.

I'm changing this to a feature request, as this is the "expected" behaviour.
 [2005-08-11 19:43 UTC] nlopess@php.net
Problem tracked in #27792.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 10:01:30 2025 UTC