xref: /PHP-7.4/Zend/tests/bug66608.phpt (revision 8ff00e6e)
1--TEST--
2Bug #66608 (Incorrect behavior with nested "finally" blocks)
3--FILE--
4<?php
5function bar() {
6	try {
7		echo "1\n";
8		try {
9		} finally {
10			try {
11			} finally {
12			}
13			echo "2\n";
14		}
15	} finally {
16		try {
17			throw new Exception ("");
18		} catch (Exception $ab) {
19			echo "3\n";
20		} finally {
21			try {
22			} finally {
23				echo "4\n";
24				try  {
25				} finally {
26				}
27				echo "5\n";
28			}
29		}
30		echo "6\n";
31		try {
32		} finally {
33			while (1) {
34				try {
35					echo "7\n";
36					break;
37				} finally {
38					echo "8\n";
39				}
40				echo "bad";
41			}
42			echo "9\n";
43			while (1) {
44				try {
45					throw new Exception("");
46				} catch(Exception $e) {
47					echo "10\n";
48					break;
49				} finally {
50					echo "11\n";
51				}
52				echo "bak\n";
53			}
54		}
55		echo "12\n";
56	}
57	echo "13\n";
58}
59bar();
60--EXPECT--
611
622
633
644
655
666
677
688
699
7010
7111
7212
7313
74