xref: /PHP-8.1/ext/spl/tests/bug81477.phpt (revision 79a28324)
1--TEST--
2Bug #81477 (LimitIterator + SplFileObject regression in 8.0.1)
3--FILE--
4<?php
5$filename = __DIR__ . '/bug81477.csv';
6
7$s = fopen($filename, 'w+');
8fwrite($s, "foo,bar\nbaz,bat\nmore,data\n");
9fclose($s);
10
11$sfo = new SplFileObject($filename);
12$sfo->setFlags(SplFileObject::READ_AHEAD);
13$limitIter = new LimitIterator($sfo, 1, -1);
14
15foreach($limitIter as $row) {
16    var_dump($row);
17}
18?>
19--EXPECT--
20string(8) "baz,bat
21"
22string(10) "more,data
23"
24string(0) ""
25--CLEAN--
26<?php
27@unlink(__DIR__ . '/bug81477.csv');
28?>
29