|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52228 fseek failure to seek
Submitted: 2010-07-01 22:00 UTC Modified: 2010-07-01 22:04 UTC
From: VJTD3 at VJTD3 dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
 [2010-07-01 22:00 UTC] VJTD3 at VJTD3 dot com
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:


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


however fseek fails:


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


Expected result:
echo the byte from position PHP_INT_MAX+1

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-01 22:04 UTC]
-Status: Open +Status: Bogus
 [2010-07-01 22:04 UTC]
We already have feature requests for that.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Jan 23 23:01:26 2021 UTC