xref: /PHP-8.1/Zend/tests/bug73338.phpt (revision 852485d8)
1--TEST--
2Bug #73338: Ensure exceptions in function init opcodes are cleaned properly
3--FILE--
4<?php
5
6try { call_user_func(new class { function __destruct () { throw new Error; } }); } catch (Error $e) {}
7
8set_error_handler(function() { throw new Error; });
9
10try { var_dump(new stdClass, call_user_func("fail")); } catch (Error $e) {}
11
12try { (function() { call_user_func("fail"); })(); } catch (Error $e) {}
13
14try { [new class { static function foo() {} function __destruct () { throw new Error; } }, "foo"](); } catch (Error $e) {}
15
16?>
17===DONE===
18--EXPECT--
19===DONE===
20