mirror of
https://github.com/php/php-src.git
synced 2026-04-20 22:41:20 +02:00
As it is, `::seek(0)` sets the file pointer to the beginning of the file, but `::seek($n)` where `$n > 0` sets the file pointer to the beginning of the following line, having line `$n` already read into the line buffer. This is pretty inconsistent; we fix it by always seeking to the beginning of the line. We also add a test case for the duplicate bug #46569. Closes GH-6434.
15 lines
245 B
PHP
15 lines
245 B
PHP
--TEST--
|
|
Bug #46569 (SplFileObject: fgetcsv after seek returns wrong line)
|
|
--FILE--
|
|
<?php
|
|
$file = new SplFileObject(__DIR__ . '/bug46569.csv');
|
|
$file->seek(1);
|
|
print_r($file->fgetcsv());
|
|
?>
|
|
--EXPECT--
|
|
Array
|
|
(
|
|
[0] => second
|
|
[1] => line
|
|
)
|