From:
Operating system: Ubuntu 10.04
PHP version: 5.3.2
Package: Apache related
Bug Type: Bug
Bug description:PHP5 under Apache2 on 64 bit system is not completely 64 bit
Description:
------------
Something in PHP5 running under apache2 under Ubuntu 9.10 is not fully 64
bit
aware on a 64 bit system. PHP scripts run under Apache correctly under
Ubuntu
8.04 (PHP 5.2.4). Under Ubuntu 9.10 (PHP 5.2.10) and 10.04 (PHP 5.3.2),
some
place a value is being treated as 32 bits on a 64 bit system and is
wrapping
instead of using full 64 bits. Related to sending large data (> 4G) in
response
to an HTTP post request.
Did not test with Ubuntu 8.10 or 9.04 - both PHP 5.2.6.
What happens: Data aborts based on wrap. Calculated number of bytes to be
served
are correct (>4G) as listed in the HTTP length header. Actual bytes served
are
(size) && 0xFFFFFFFF instead of (size) && 0xFFFFFFFFFFFFFFFF on 64 bit
system.
Most of data is being transfered via fpassthru($openFileHandle) call,
providing
>4G bytes of data.
Test script:
---------------
<?php
header("Connection: close");
// NOTE: File test.txt needs to be more than 2^32 bytes. Pick a large
file, over 0x100000000 bytes
// in size, such as
http://cdimage.debian.org/debian-cd/5.0.4/amd64/iso-dvd/debian-504-amd64-DVD-1.iso
$name = "/var/www/test.txt";
$fs = filesize($name);
$fp = fopen($name,'rb');
$httpByteLen = $fs;
header("Connection: close");
header("Content-Type: application/octet-stream");
header("Content-Length: " . $httpByteLen);
header("HTTP/1.1 200 OK");
set_time_limit(0);
fpassthru($fp);
exit;
?>
Expected result:
----------------
The entire ISO file to be downloaded.
Actual result:
--------------
Tested using the test script (attached), and using the suggested debian dvd
.iso
image as the input file. The ISO is 4,697,126,912 bytes. Download socket
is
closed after 402,159,616 bytes, which again is the file size & 0xFFFFFFFF.
--
Edit bug report at http://bugs.php.net/bug.php?id=52102&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52102&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52102&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52102&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52102&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52102&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52102&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52102&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52102&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52102&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52102&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52102&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52102&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52102&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52102&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52102&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52102&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52102&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52102&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52102&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52102&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52102&r=mysqlcfg