summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2011-09-17 00:16:11 +0000
committerFelipe Pena <felipe@php.net>2011-09-17 00:16:11 +0000
commit5441cd1f0d6fc4e6fafded617e38230466d786ec (patch)
treecb868a70318e6789ce2619c3d03f5b4cd169b7d9
parent258c8de7fb0d92168c4b594e548bf010ceee2ce8 (diff)
downloadphp-git-5441cd1f0d6fc4e6fafded617e38230466d786ec.tar.gz
- Fixed bug #55705 (Omitting a callable typehinted argument causes a segfault)
patch by: laruence@php
-rw-r--r--Zend/tests/bug55705.phpt9
-rw-r--r--Zend/zend_execute.c3
2 files changed, 12 insertions, 0 deletions
diff --git a/Zend/tests/bug55705.phpt b/Zend/tests/bug55705.phpt
new file mode 100644
index 0000000000..69220bfdeb
--- /dev/null
+++ b/Zend/tests/bug55705.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #55705 (Omitting a callable typehinted argument causes a segfault)
+--FILE--
+<?php
+function f(callable $c) {}
+f();
+?>
+--EXPECTF--
+Catchable fatal error: Argument 1 passed to f() must be callable, none given, called in %s on line 3 and defined in %s on line %d
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 20d21402ed..e24a3dd6f2 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -639,6 +639,9 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
break;
case IS_CALLABLE:
+ if (!arg) {
+ return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", "none", "" TSRMLS_CC);
+ }
if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "" TSRMLS_CC);
}