Edit report at http://bugs.php.net/bug.php?id=34750&edit=1

 ID:                 34750
 Comment by:         dominic dot benson at thirdlight dot com
 Reported by:        aulbach at mayflower dot de
 Summary:            filesize()/stat() fails on too big files
 Status:             Open
 Type:               Feature/Change Request
 Package:            Feature/Change Request
 Operating System:   *
 PHP Version:        5CVS,6CVS,4CVS (2008-02-22)
 Block user comment: N

 New Comment:

The patch takes advantage of floats being doubles in PHP (with 53 bits
of precision under linux 32) - in the patch LLONG_MAX is hardcoded as
its actual value, this should really be derived from limits.h. It
depends on PHP being built with the largefile compile flags to actually
work (it fixes the integer wrapping that then occurs). It should be
harmless on 64 bit, but ideally configure would check long vs. double on
the system and include the additional section or not based on that.


Previous Comments:
------------------------------------------------------------------------
[2005-10-06 10:38:36] aulbach at mayflower dot de

- it's not a feature request, it's a workarround over a problem, that
otherwise cannot be solved within PHP! (without calling external
programs)



- For longer term, there is no question, that PHP needs 64 bit integer.

------------------------------------------------------------------------
[2005-10-06 10:22:20] der...@php.net

This is not a bug, but a feature request.

------------------------------------------------------------------------
[2005-10-06 10:08:18] aulbach at mayflower dot de

Description:
------------
Writing a php command-line script, which scans all my files on my big
raid, I mentioned, that PHP is not able to handle the case, when the
files are bigger than 4 GB. But this is more and more used, cause for
example complete DVD-images are just put in one file.



PHP itself cannot handle bigger numbers, cause it uses 32 bit integer.



Currently I help me with `ls` but that's no real solution.



Everyone is using 64 bit integer now. There are many cases, timestamps
for example.



For now I suggest, that the number is stored as a string, if it gets too
big. I use that number only to write it into the database (which can
handle 64 bit int), so for that case this is correct.



For long term, I suggest a mechanism, that automatically assigns 64 bit
integer, if the number gets too big.



Reproduce code:
---------------
$fsize = filesize($path); // returns invalid if file is too big, the
rest of the program will fail, if I assume, that there will be a number



OR



$stats = stat($path); // complete record invalid



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



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=34750&edit=1

Reply via email to