|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52102 PHP5 under Apache2 on 64 bit system is not completely 64 bit
Submitted: 2010-06-16 19:39 UTC Modified: 2011-03-19 02:29 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: peter at ubuntu dot com Assigned:
Status: Duplicate Package: Apache related
PHP Version: 5.3.2 OS: Ubuntu 10.04
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: peter at ubuntu dot com
New email:
PHP Version: OS:


 [2010-06-16 19:39 UTC] peter at ubuntu dot com
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:
    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 
    $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");

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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-17 04:44 UTC]
-Status: Open +Status: Duplicate
 [2010-06-17 04:44 UTC]
Dupe of bug #44522.
 [2011-03-18 20:37 UTC]
Adam, this bug report is related to sending files to the client and doesn't seem 
to be related to variable types. I don't think this is a dup of #44522.
The interesting stuff can be found at (message #18 and 
 [2011-03-19 02:29 UTC]
> doesn't seem to be related to variable types
Oops, let's pretend I didn't actually say that.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 21 02:01:28 2024 UTC