com php-src: Added tests: Zend/tests/try/try_finally_01 9.phpt Zend/tests/try/try_finally_020.phpt

From: Date: Tue, 10 Nov 2015 11:09:30 +0000
Subject: com php-src: Added tests: Zend/tests/try/try_finally_01 9.phpt Zend/tests/try/try_finally_020.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-89729@lists.php.net to get a copy of this message
Commit: 17d9bc9222ced1b97603d219ba96675e43775b1d Author: Dmitry Stogov <dmitry@zend.com> Mon, 9 Nov 2015 23:54:09 +0300 Committer: Anatol Belski <ab@php.net> Tue, 10 Nov 2015 12:09:30 +0100 Parents: bf9d2d47d8d8aa623f1fb3015c3b7be0d9b938d8 Branches: PHP-7.0.0 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=17d9bc9222ced1b97603d219ba96675e43775b1d Log: Added tests Changed paths: A Zend/tests/try/try_finally_019.phpt A Zend/tests/try/try_finally_020.phpt Diff: diff --git a/Zend/tests/try/try_finally_019.phpt b/Zend/tests/try/try_finally_019.phpt new file mode 100644 index 0000000...2e2069d --- /dev/null +++ b/Zend/tests/try/try_finally_019.phpt @@ -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 diff --git a/Zend/tests/try/try_finally_020.phpt b/Zend/tests/try/try_finally_020.phpt new file mode 100644 index 0000000..1775681 --- /dev/null +++ b/Zend/tests/try/try_finally_020.phpt @@ -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

« previous php.cvs (#89729) next »