mirror of
https://github.com/php/php-src.git
synced 2026-03-24 16:22:37 +01: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.
23 lines
344 B
PHP
23 lines
344 B
PHP
--TEST--
|
|
SPL: SplFileObject::key error
|
|
--CREDITS--
|
|
Ricardo Oedietram <ricardo@odracir.nl>
|
|
Erwin Poeze <erwin.poeze@gmail.com>
|
|
#PFZ June PHP TestFest 2012
|
|
--FILE--
|
|
<?php
|
|
//line 2
|
|
//line 3
|
|
//line 4
|
|
//line 5
|
|
$s = new SplFileObject(__FILE__);
|
|
|
|
$s->seek(13);
|
|
$s->next();
|
|
var_dump($s->key());
|
|
var_dump($s->valid());
|
|
?>
|
|
--EXPECT--
|
|
int(14)
|
|
bool(false)
|