xref: /PHP-8.1/Zend/tests/bug44184.phpt (revision f8d79582)
1--TEST--
2Bug #44184 (Double free of loop-variable on exception)
3--FILE--
4<?php
5function foo() {
6    $x = array(1,2,3);
7    foreach ($x as $a) {
8        while (1) {
9            throw new Exception();
10        }
11        return;
12    }
13}
14try {
15    foo();
16} catch (Exception $ex) {
17    echo "ok\n";
18}
19?>
20--EXPECT--
21ok
22