summaryrefslogtreecommitdiff
path: root/Zend/tests/bug71154.phpt
blob: 6186453816cb2a3be3ef32ec6fe51719105a3754 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--TEST--
Bug #71154: Incorrect HT iterator invalidation causes iterator reuse
--FILE--
<?php

$array = [1, 2, 3];
foreach ($array as &$ref) {
    /* Free array, causing free of iterator */
    $array = [];
    /* Reuse the iterator.
     * However it will also be reused on next foreach iteration */
    $it = new ArrayIterator([1, 2, 3]);
    $it->rewind();
}
var_dump($it->current());

?>
--EXPECT--
int(1)