Bug #81477 [NEW]: LimitIterator + SplFileObject regression/changed behavior in 8.0.1+

From: Date: Sat, 25 Sep 2021 00:49:49 +0000
Subject: Bug #81477 [NEW]: LimitIterator + SplFileObject regression/changed behavior in 8.0.1+
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236826@lists.php.net to get a copy of this message
From: john at zerocrates dot org Operating system: Linux PHP version: 8.0.11 Package: SPL related Bug Type: Bug Bug description:LimitIterator + SplFileObject regression/changed behavior in 8.0.1+ 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 bug report at https://bugs.php.net/bug.php?id=81477&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81477&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81477&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81477&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81477&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81477&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81477&r=support Expected behavior: https://bugs.php.net/fix.php?id=81477&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81477&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81477&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81477&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81477&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81477&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81477&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81477&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81477&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81477&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81477&r=mysqlcfg

« previous php.bugs (#236826) next »