xref: /PHP-7.3/Zend/tests/bug37046.phpt (revision 610c7fbe)
1--TEST--
2Bug #37046 (foreach breaks static scope)
3--FILE--
4<?php
5function s() {
6  static $storage = array(array('x', 'y'));
7  return $storage[0];
8}
9
10foreach (s() as $k => $function) {
11  echo "op1 $k\n";
12  if ($k == 0) {
13    foreach (s() as $k => $function) {
14      echo "op2 $k\n";
15    }
16  }
17}
18?>
19--EXPECT--
20op1 0
21op2 0
22op2 1
23op1 1
24