php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40726 fseek / ftell do not work correctly for files > 2GB
Submitted: 2007-03-05 11:19 UTC Modified: 2007-03-05 11:24 UTC
From: plamen at pulsator dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.2.1 OS: FreeBSD 6.2 i386
Private report: No CVE-ID: None
 [2007-03-05 11:19 UTC] plamen at pulsator dot com
Description:
------------
fseek does not move the pointer over 2GB limit even if Large File Support is compiled according to the Filesystem functions instruction at the php manual (but if you want PHP to support LFS (large files) on Linux, then you need to have a recent glibc and you need compile PHP with the following compiler flags: -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64. )
Consecutive ftell() calls return 0 

Reproduce code:
---------------
 $fp=fopen("Some Large File",'r');
 fseek($fp,2147483648,SEEK_SET);
 echo ftell($fp);

Expected result:
----------------
2147483648

Actual result:
--------------
0

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-05 11:24 UTC] tony2001@php.net
PHP uses "signed long" internally.
We're still considering a possibility to add a cross-platform 64-bit long, though until it's done you're bound to your native long limits.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC