summaryrefslogtreecommitdiff
path: root/Zend/tests/bug73338.phpt
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2016-10-18 14:13:20 +0200
committerBob Weinand <bobwei9@hotmail.com>2016-10-18 14:14:24 +0200
commit8b177f6a2a2782107461d7153385857872e2f4b9 (patch)
tree4bce69528a6b68e42ae43702b2d3d48152073405 /Zend/tests/bug73338.phpt
parent7bd4e7208e26e3e441717c0f33a154a385764d06 (diff)
downloadphp-git-8b177f6a2a2782107461d7153385857872e2f4b9.tar.gz
Fixed bug #73338 (Exception thrown from error handler may crash)
Diffstat (limited to 'Zend/tests/bug73338.phpt')
-rw-r--r--Zend/tests/bug73338.phpt18
1 files changed, 18 insertions, 0 deletions
diff --git a/Zend/tests/bug73338.phpt b/Zend/tests/bug73338.phpt
new file mode 100644
index 0000000000..df4c3b66e4
--- /dev/null
+++ b/Zend/tests/bug73338.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #73338: Ensure exceptions in function init opcodes are cleaned properly
+--FILE--
+<?php
+
+try { call_user_func(new class { function __destruct () { throw new Error; } }); } catch (Error $e) {}
+
+set_error_handler(function() { throw new Error; });
+
+try { var_dump(new stdClass, call_user_func("fail")); } catch (Error $e) {}
+
+try { (function() { call_user_func("fail"); })(); } catch (Error $e) {}
+
+try { [new class { static function foo() {} function __destruct () { throw new Error; } }, "foo"](); } catch (Error $e) {}
+
+?>
+--EXPECTF--
+Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in %s on line %d