summaryrefslogtreecommitdiff
path: root/Zend/tests/bug40705.phpt
blob: 374f73b75eb63a6d6bd29f2ce9ec9ff8f6bf7fdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--TEST--
Bug #40705 (Iterating within function moves original array pointer)
--FILE--
<?php
function doForeach($array)
{
    foreach ($array as $k => $v) {
        // do stuff
    }
}

$foo = array('foo', 'bar', 'baz');
var_dump(key($foo));
doForeach($foo);
var_dump(key($foo));
foreach ($foo as $k => $v) {
	var_dump($k);
}
var_dump(key($foo));
--EXPECT--
int(0)
int(0)
int(0)
int(1)
int(2)
NULL