1
0
mirror of https://github.com/php/php-src.git synced 2026-04-19 05:51:02 +02:00
Files
archived-php-src/ext/spl/tests/bug81477.phpt
Christoph M. Becker ee5711de33 Fix #81477: LimitIterator + SplFileObject regression in 8.0.1
We must not free the read line, if the `READ_AHEAD` flag is set.  This
also restores the expectations of SplFileObject_next_variation002.phpt.

Closes GH-7518.
2021-09-29 16:17:14 +02:00

29 lines
519 B
PHP

--TEST--
Bug #81477 (LimitIterator + SplFileObject regression in 8.0.1)
--FILE--
<?php
$filename = __DIR__ . '/bug81477.csv';
$s = fopen($filename, 'w+');
fwrite($s, "foo,bar\nbaz,bat\nmore,data\n");
fclose($s);
$sfo = new SplFileObject($filename);
$sfo->setFlags(SplFileObject::READ_AHEAD);
$limitIter = new LimitIterator($sfo, 1, -1);
foreach($limitIter as $row) {
var_dump($row);
}
?>
--EXPECT--
string(8) "baz,bat
"
string(10) "more,data
"
string(0) ""
--CLEAN--
<?php
@unlink(__DIR__ . '/bug81477.csv');
?>