]> granicus.if.org Git - php/commitdiff
- Fixed bug #55705 (Omitting a callable typehinted argument causes a segfault)
authorFelipe Pena <felipe@php.net>
Sat, 17 Sep 2011 00:16:11 +0000 (00:16 +0000)
committerFelipe Pena <felipe@php.net>
Sat, 17 Sep 2011 00:16:11 +0000 (00:16 +0000)
  patch by: laruence@php

Zend/tests/bug55705.phpt [new file with mode: 0644]
Zend/zend_execute.c

diff --git a/Zend/tests/bug55705.phpt b/Zend/tests/bug55705.phpt
new file mode 100644 (file)
index 0000000..69220bf
--- /dev/null
@@ -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
index 20d21402edde09037630e9416666168d20d63d16..e24a3dd6f226d0c7ba72c0682f3750aee97f540f 100644 (file)
@@ -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);
                                }