php.net |  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
Votes:1
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.
Password:
Status:
Package:
Bug Type:
Summary:
From: peter at ubuntu dot com
New email:
PHP Version: OS:

 

 [2010-06-16 19:39 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-17 04:44 UTC] aharvey@php.net
-Status: Open +Status: Duplicate
 [2010-06-17 04:44 UTC] aharvey@php.net
Dupe of bug #44522.
 [2011-03-18 20:37 UTC] geissert@php.net
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 
https://bugs.launchpad.net/ubuntu/+source/php5/+bug/564920 (message #18 and 
followups)
 [2011-03-19 02:29 UTC] geissert@php.net
> 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: Fri Apr 19 13:01:30 2024 UTC