xref: /PHP-7.1/Zend/tests/bug40509.phpt (revision 7af945e2)
1--TEST--
2Bug #40509 (key() function changed behaviour if global array is used within function)
3--FILE--
4<?php
5function foo()
6{
7	global $arr;
8
9	$c = $arr["v"];
10	foreach ($c as $v) {}
11}
12
13$arr["v"] = array("a");
14
15var_dump(key($arr["v"]));
16foo();
17var_dump(key($arr["v"]));
18foreach ($arr["v"] as $k => $v) {
19	var_dump($k);
20}
21var_dump(key($arr["v"]));
22--EXPECT--
23int(0)
24int(0)
25int(0)
26int(0)
27