Bug #52228 [NEW]: fseek failure to seek

From: Date: Thu, 01 Jul 2010 20:00:18 +0000
Subject: Bug #52228 [NEW]: fseek failure to seek
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-152017@lists.php.net to get a copy of this message
From:             
Operating system: *
PHP version:      Irrelevant
Package:          Filesystem function related
Bug Type:         Bug
Bug description:fseek failure to seek

Description:
------------
2147483647 or PHP_INT_MAX on the system is the max integer. fseek fails
with files over PHP_INT_MAX+2 in size. binary math would resolve the fseek
issue internally.

Test script:
---------------
reading a file of 20 gigabytes (or anything larger then PHP_INT_MAX+2) is
successful with:

<?php

 $handle = fopen('20gbfile', 'r');
 while (!feof($handle)) {
  echo fread($handle, PHP_INT_MAX);
 }
 fclose($handle);

?>

however fseek fails:

<?php

 $handle = fopen('20gbfile', 'r');
 echo fread($handle, PHP_INT_MAX);
 echo fread($handle, 2);
 fseek($handle, -1, SEEK_CUR);
 echo fread($handle, 1);
 fclose($handle);

?>

Expected result:
----------------
echo the byte from position PHP_INT_MAX+1

Actual result:
--------------
crash/fail

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



Thread (2 messages)

« previous php.bugs (#152017) next »