xref: /php-src/Zend/tests/throw/leaks.phpt (revision d313ad60)
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// Exit also unwinds and thus has the same basic problem.
27new stdClass(exit);
28
29?>
30--EXPECT--
31Caught
32Caught
33Caught
34int(30719)
35