Bug #81477 [Opn->Ver]: Fix #81477: LimitIterator + SplFileObject regression in 8.0.1

From: Date: Mon, 27 Sep 2021 11:08:46 +0000
Subject: Bug #81477 [Opn->Ver]: Fix #81477: LimitIterator + SplFileObject regression in 8.0.1
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236855@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81477&edit=1 ID: 81477 Updated by: cmb@php.net Reported by: john at zerocrates dot org -Summary: LimitIterator + SplFileObject regression/changed behavior in 8.0.1+ +Summary: Fix #81477: LimitIterator + SplFileObject regression in 8.0.1 -Status: Open +Status: Verified Type: Bug Package: SPL related Operating System: Linux PHP Version: 8.0.11 Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2021-09-25 00:49:49] john at zerocrates dot org Description: ------------ 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: --------------- See https://3v4l.org/2SRvp <?php $s = fopen('/tmp/test.csv', 'w+'); fwrite($s, "foo,bar\nbaz,bat\nmore,data\n"); fclose($s); $sfo = new SplFileObject('/tmp/test.csv'); $sfo->setFlags(SplFileObject::READ_AHEAD); $limitIter = new LimitIterator($sfo, 1, -1); foreach($limitIter as $row) { var_dump($row); } Expected result: ---------------- string(8) "baz,bat " string(10) "more,data " string(0) "" Actual result: -------------- [no output] ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81477&edit=1

« previous php.bugs (#236855) next »