1--TEST--
2foreach() (and other) variables aren't leaked on premature close
3--FILE--
4<?php
5
6function gen(array $array) {
7	foreach ($array as $value) {
8		yield $value;
9	}
10}
11
12$gen = gen(['Foo', 'Bar']);
13var_dump($gen->current());
14
15// generator is closed here, without running SWITCH_FREE
16
17?>
18--EXPECT--
19string(3) "Foo"
20