FS#18362 - [php52] php can't handle files over 3GB

Attached to Project: Community Packages
Opened by Nahum Shalman (nshalman) - Tuesday, 16 February 2010, 18:05 GMT
Last edited by Evangelos Foutras (foutrelis) - Wednesday, 17 February 2010, 10:27 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Evangelos Foutras (foutrelis)
Architecture i686
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
Something about the php52 package (the build process?) is preventing php from being able to handle large files (at the very least it can't return the file size).

Could be related: http://bugs.php.net/bug.php?id=27792

Comment from the developers of a package that depends on php that is failing:
'[...] if your PHP installation was not compiled with the following
flags "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64".'

Additional info:
* package version: php52 5.2.12-3
* config and/or log files etc.


Steps to reproduce:

1. create a file that is over 2GB
2. create php test code file (below)
3. run sample php code "php -f test.php"
4. note the absence of the file size for the large file.

test.php:
---------------
<?php

if ($handle = opendir('.')) {
echo "Directory handle: $handle\n";
echo "Files:\n";

while (false !== ($file = readdir($handle))) {
echo "name: $file\n\tsize: ";
echo filesize( $file );
echo "\n\tsprintf: ";
echo sprintf("%u", filesize($file));
echo "\n";
}

closedir($handle);
}
?>
---------------

example:

$ ls -la ; php -f test.php
total 4034416
drwxrwsr-x 2 http http 4096 Feb 16 12:53 .
drwsrwsr-x 10 http http 4096 Feb 16 12:45 ..
-rw-rw-r-- 1 http htpp 322 Feb 16 12:53 test.php
-rw-rw-r-- 1 http http 4127195136 Feb 1 11:33 testfile.dat
Directory handle: Resource id #4
Files:
name: testfile.dat
size:
sprintf: 0
name: test.php
size: 322
sprintf: 322
name: .
size: 4096
sprintf: 4096
name: ..
size: 4096
sprintf: 4096
This task depends upon

Closed by  Evangelos Foutras (foutrelis)
Wednesday, 17 February 2010, 10:27 GMT
Reason for closing:  Upstream
Additional comments about closing:  See PHP bugs #27792 and #48886.
Comment by Nahum Shalman (nshalman) - Tuesday, 16 February 2010, 18:22 GMT
attaching the php test file
   test.php (0.3 KiB)
Comment by Evangelos Foutras (foutrelis) - Tuesday, 16 February 2010, 20:00 GMT
I'm afraid there isn't much we can do about this. It seems that the issue has been known upstream for quite a while but hasn't been fixed yet.

Please note that x86_64 behaves correctly so you may want to use that instead (not the best solution, I know).
Comment by Evangelos Foutras (foutrelis) - Tuesday, 16 February 2010, 20:07 GMT
For the record, a smaller test case is:

$ dd if=/dev/zero of=huge bs=1M seek=2048 count=0
$ php -r 'echo filesize("huge")."\n";'

Loading...