mirror of
https://github.com/php/php-src.git
synced 2026-04-22 07:28:09 +02:00
79a283240e
Although the fix is partially correct it also breaks long standing behaviour which has been produced since PHP 5.3.
This reverts commit 6f87a5c633.
87 lines
1.2 KiB
PHP
87 lines
1.2 KiB
PHP
--TEST--
|
|
SPL: SplFileObject::seek'ing
|
|
--FILE--
|
|
<?php
|
|
|
|
$o = new SplFileObject(__DIR__ . '/fileobject_001a.txt');
|
|
|
|
var_dump($o->key());
|
|
var_dump($o->current());
|
|
$o->setFlags(SplFileObject::DROP_NEW_LINE);
|
|
var_dump($o->key());
|
|
var_dump($o->current());
|
|
var_dump($o->key());
|
|
$o->next();
|
|
var_dump($o->key());
|
|
var_dump($o->current());
|
|
var_dump($o->key());
|
|
$o->rewind();
|
|
var_dump($o->key());
|
|
var_dump($o->current());
|
|
var_dump($o->key());
|
|
$o->seek(4);
|
|
var_dump($o->key());
|
|
var_dump($o->current());
|
|
var_dump($o->key());
|
|
|
|
echo "===A===\n";
|
|
foreach($o as $n => $l)
|
|
{
|
|
var_dump($n, $l);
|
|
}
|
|
|
|
echo "===B===\n";
|
|
$o = new SplFileObject(__DIR__ . '/fileobject_001b.txt');
|
|
$o->setFlags(SplFileObject::DROP_NEW_LINE);
|
|
foreach($o as $n => $l)
|
|
{
|
|
var_dump($n, $l);
|
|
}
|
|
|
|
?>
|
|
--EXPECTF--
|
|
int(0)
|
|
string(%d) "0
|
|
"
|
|
int(0)
|
|
string(%d) "0
|
|
"
|
|
int(0)
|
|
int(1)
|
|
string(1) "1"
|
|
int(1)
|
|
int(0)
|
|
string(1) "0"
|
|
int(0)
|
|
int(4)
|
|
string(1) "4"
|
|
int(4)
|
|
===A===
|
|
int(0)
|
|
string(1) "0"
|
|
int(1)
|
|
string(1) "1"
|
|
int(2)
|
|
string(1) "2"
|
|
int(3)
|
|
string(1) "3"
|
|
int(4)
|
|
string(1) "4"
|
|
int(5)
|
|
string(1) "5"
|
|
int(6)
|
|
string(0) ""
|
|
===B===
|
|
int(0)
|
|
string(1) "0"
|
|
int(1)
|
|
string(1) "1"
|
|
int(2)
|
|
string(1) "2"
|
|
int(3)
|
|
string(1) "3"
|
|
int(4)
|
|
string(1) "4"
|
|
int(5)
|
|
string(1) "5"
|