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

 ID:               52102
 Updated by:       ahar...@php.net
 Reported by:      peter at ubuntu dot com
 Summary:          PHP5 under Apache2 on 64 bit system is not completely
                   64 bit
-Status:           Open
+Status:           Duplicate
 Type:             Bug
 Package:          Apache related
 Operating System: Ubuntu 10.04
 PHP Version:      5.3.2

 New Comment:

Dupe of bug #44522.


Previous Comments:
------------------------------------------------------------------------
[2010-06-16 19:39:56] peter at ubuntu dot com

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 this bug report at http://bugs.php.net/bug.php?id=52102&edit=1

Reply via email to