mirror of
https://github.com/php/php-src.git
synced 2024-09-23 10:57:26 +00:00
9a9eed472b
When a HT iterator is one past the end and we rehash, we need to make sure that it is move to the new one past the end position, to make sure that newly inserted elements are picked up.
53 lines
990 B
PHP
53 lines
990 B
PHP
--TEST--
|
|
Bug #77903: ArrayIterator stops iterating after offsetSet call
|
|
--FILE--
|
|
<?php
|
|
$a = new ArrayIterator();
|
|
$a->rewind();
|
|
var_dump($a->valid()); // false
|
|
var_dump($a->current()); // null
|
|
$a->offsetSet(1,1);
|
|
var_dump($a->valid()); // true
|
|
var_dump($a->current()); // 1
|
|
$a->next();
|
|
var_dump($a->valid()); // false
|
|
var_dump($a->current()); // null
|
|
$a->offsetSet(4,4);
|
|
var_dump($a->valid()); // true
|
|
var_dump($a->current()); // 4
|
|
$a->next();
|
|
var_dump($a->valid()); // false
|
|
var_dump($a->current()); // null
|
|
$a->next();
|
|
var_dump($a->valid()); // false
|
|
var_dump($a->current()); // null
|
|
$a->offsetSet(2,2);
|
|
var_dump($a->valid()); // true
|
|
var_dump($a->current()); // 2
|
|
$a->next();
|
|
var_dump($a->valid()); // false
|
|
var_dump($a->current()); // null
|
|
$a->next();
|
|
var_dump($a->valid()); // false
|
|
var_dump($a->current()); // null
|
|
?>
|
|
--EXPECT--
|
|
bool(false)
|
|
NULL
|
|
bool(true)
|
|
int(1)
|
|
bool(false)
|
|
NULL
|
|
bool(true)
|
|
int(4)
|
|
bool(false)
|
|
NULL
|
|
bool(false)
|
|
NULL
|
|
bool(true)
|
|
int(2)
|
|
bool(false)
|
|
NULL
|
|
bool(false)
|
|
NULL
|