blob: cd98f6567d46d4f889d5abf62cd3ef12132c9be1 (
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
|
--TEST--
Bug #71980: Decorated/Nested Generator is Uncloseable in Finally
--FILE--
<?php
class Dtor {
public function __destruct() {
echo "Dtor\n";
}
}
function gen1() {
try {
foreach ([42, new Dtor] as $value) {
yield $value;
}
} finally {
echo "Finally\n";
}
}
function gen2() {
try {
var_dump(new Dtor, yield);
} finally {
echo "Finally\n";
}
}
$gen = gen1();
$gen->rewind();
unset($gen);
$gen = gen2();
$gen->rewind();
unset($gen);
?>
--EXPECT--
Dtor
Finally
Dtor
Finally
|