1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/Zend/tests/try/try_finally_012.phpt
2020-02-03 22:52:20 +01:00

32 lines
524 B
PHP

--TEST--
Try finally (exception in "return" statement)
--FILE--
<?php
class A {
public $x = 1;
public $y = 2;
function __destruct() {
throw new Exception();
}
}
function foo() {
foreach(new A() as $a) {
try {
return $a;
} catch (Exception $e) {
echo "exception in foo\n";
} finally {
echo "finally\n";
}
}
}
try {
foo();
} catch (Exception $e) {
echo "exception in main\n";
}
?>
--EXPECT--
finally
exception in main