Bug #66736 [NEW]: fpassthru broken

From: Date: Tue, 18 Feb 2014 19:49:37 +0000
Subject: Bug #66736 [NEW]: fpassthru broken
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184347@lists.php.net to get a copy of this message
From:             evert at rooftopsolutions dot nl
Operating system: OS X
PHP version:      5.5.9
Package:          Streams related
Bug Type:         Bug
Bug description:fpassthru broken

Description:
------------
fpassthru is broken for files > 2GB on 64bit systems.

Tested with OS X, but also getting reports from users of other operating
systems.

Likely there's an integer overflow issue.

Reference: http://evertpot.com/fpassthru-broken/

Test script:
---------------
# 5GB file

dd if=/dev/zero of=5gb bs=1024 count=5242880
php -r "fpassthru(fopen('5gb','r'));" > output_5gb

# 3GB file

dd if=/dev/zero of=3gb bs=1024 count=3145728
php -r "fpassthru(fopen('3gb','r'));" > output_3gb

# Comparing outputs

ls -lh


Expected result:
----------------
-rw-r--r--   1 evert  staff   3.0G 18 Feb 14:43 3gb
-rw-r--r--   1 evert  staff   5.0G 18 Feb 14:41 5gb
-rw-r--r--   1 evert  staff   3.0G 18 Feb 14:45 output_3gb
-rw-r--r--   1 evert  staff   5.0G 18 Feb 14:44 output_5gb

Actual result:
--------------
-rw-r--r--   1 evert  staff   3.0G 18 Feb 14:43 3gb
-rw-r--r--   1 evert  staff   5.0G 18 Feb 14:41 5gb
-rw-r--r--   1 evert  staff     0B 18 Feb 14:45 output_3gb
-rw-r--r--   1 evert  staff   1.0G 18 Feb 14:44 output_5gb

-- 
Edit bug report at https://bugs.php.net/bug.php?id=66736&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=66736&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=66736&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=66736&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=66736&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=66736&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=66736&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=66736&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=66736&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=66736&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=66736&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=66736&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=66736&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=66736&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66736&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=66736&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=66736&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=66736&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66736&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=66736&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=66736&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#184347) next »