|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81477 Fix #81477: LimitIterator + SplFileObject regression in 8.0.1
Submitted: 2021-09-25 00:49 UTC Modified: 2021-09-27 11:08 UTC
From: john at zerocrates dot org Assigned:
Status: Closed Package: SPL related
PHP Version: 8.0.11 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: john at zerocrates dot org
New email:
PHP Version: OS:


 [2021-09-25 00:49 UTC] john at zerocrates dot org
PHP 8.0.1+ seems to introduce a new issue with LimitIterator and SplFileObject, where the wrapping LimitIterator just is "empty" immediately.

I encountered this with READ_CSV | READ_AHEAD | SKIP_EMPTY as the SplFileObject flags but it seems to just be READ_AHEAD that causes the issue. I also initially thought this only happened when the offset was 1 line away from EOF but I can reproduce further away.

Just a guess that it may be related to or a regression caused by Bug 68004 given the 8.0.1 coincidence.

Test script:


$s = fopen('/tmp/test.csv', 'w+');
fwrite($s, "foo,bar\nbaz,bat\nmore,data\n");

$sfo = new SplFileObject('/tmp/test.csv');
$limitIter = new LimitIterator($sfo, 1, -1);

foreach($limitIter as $row) {

Expected result:
string(8) "baz,bat
string(10) "more,data
string(0) ""

Actual result:
[no output]


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-09-27 11:08 UTC]
-Summary: LimitIterator + SplFileObject regression/changed behavior in 8.0.1+ +Summary: Fix #81477: LimitIterator + SplFileObject regression in 8.0.1 -Status: Open +Status: Verified
 [2021-09-27 11:09 UTC]
The following pull request has been associated:

Patch Name: Fix #81477: LimitIterator + SplFileObject regression in 8.0.1
On GitHub:
 [2021-09-29 14:19 UTC]
Automatic comment on behalf of cmb69
Log: Fix #81477: LimitIterator + SplFileObject regression in 8.0.1
 [2021-09-29 14:19 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Oct 25 17:03:33 2021 UTC