xref: /PHP-8.0/Zend/tests/throw/leaks.phpt (revision 19e886d9)
1--TEST--
2throw expression should not leak temporaries
3--FILE--
4<?php
5
6try {
7    new stdClass(throw new Exception);
8} catch (Exception $e) {
9    echo "Caught\n";
10}
11
12try {
13    $a = [];
14    ($a + [1]) + throw new Exception;
15} catch (Exception $e) {
16    echo "Caught\n";
17}
18
19try {
20    @throw new Exception;
21} catch (Exception $e) {
22    echo "Caught\n";
23}
24var_dump(error_reporting());
25
26?>
27--EXPECT--
28Caught
29Caught
30Caught
31int(32767)
32