summaryrefslogtreecommitdiff
path: root/Zend/tests/temporary_cleaning_005.phpt
blob: e8c7febe0b12ddc4c5cbfe606aed6056ab2c928d (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
--TEST--
Temporary leak with foreach
--FILE--
<?php

function ops() {
    throw new Exception();
}

$a = [new stdClass, new stdClass];
foreach ([$a, [new stdClass]] as $b) {
	switch ($b[0]) {
		case false:
		break;
		default:
			try {
				$x = 2;
				$y = new stdClass;
				while ($x-- && new stdClass) {
					$r = [$x] + ($y ? ((array) $x) + [2] : ops());
					$y = (array) $y;
				}
			} catch (Exception $e) {
			}
	}
}

foreach ([$a, [new stdClass]] as $b) {
	try {
		switch ($b[0]) {
			case false:
			break;
			default:
				$x = 2;
				$y = new stdClass;
				while ($x-- && new stdClass) {
					$r = [$x] + ($y ? ((array) $x) + [2] : ops());
					$y = (array) $y;
				}
		}
	} catch (Exception $e) {
	}
}

?>
==DONE==
--EXPECT--
==DONE==