mirror of
https://github.com/php/php-src.git
synced 2024-09-25 11:57:26 +00:00
Merge branch 'PHP-7.0'
* PHP-7.0: Added tests
This commit is contained in:
commit
67990fc0a4
40
Zend/tests/try/try_finally_019.phpt
Normal file
40
Zend/tests/try/try_finally_019.phpt
Normal file
@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Combination of foreach, finally and goto (call order)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
public $n = 0;
|
||||
function __construct($n) {
|
||||
$this->n = $n;
|
||||
}
|
||||
function __destruct() {
|
||||
echo "destruct" . $this->n . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ([new A(1)] as $a) {
|
||||
$a = null;
|
||||
try {
|
||||
foreach ([new A(2)] as $a) {
|
||||
$a = null;
|
||||
try {
|
||||
foreach ([new A(3)] as $a) {
|
||||
$a = null;
|
||||
goto out;
|
||||
}
|
||||
} finally {
|
||||
echo "finally1\n";
|
||||
}
|
||||
out: ;
|
||||
}
|
||||
} finally {
|
||||
echo "finally2\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
destruct3
|
||||
finally1
|
||||
destruct2
|
||||
finally2
|
||||
destruct1
|
44
Zend/tests/try/try_finally_020.phpt
Normal file
44
Zend/tests/try/try_finally_020.phpt
Normal file
@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
Combination of foreach, finally and exception (call order)
|
||||
--XFAIL--
|
||||
See Bug #62210 and attempt to fix it in "tmp_liveliness" branch
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
public $n = 0;
|
||||
function __construct($n) {
|
||||
$this->n = $n;
|
||||
}
|
||||
function __destruct() {
|
||||
echo "destruct" . $this->n . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ([new A(1)] as $a) {
|
||||
$a = null;
|
||||
try {
|
||||
foreach ([new A(2)] as $a) {
|
||||
$a = null;
|
||||
try {
|
||||
foreach ([new A(3)] as $a) {
|
||||
$a = null;
|
||||
throw new Exception();
|
||||
}
|
||||
} finally {
|
||||
echo "finally1\n";
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo "catch\n";
|
||||
} finally {
|
||||
echo "finally2\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
destruct3
|
||||
finally1
|
||||
destruct2
|
||||
catch
|
||||
finally2
|
||||
destruct1
|
Loading…
Reference in New Issue
Block a user