]> granicus.if.org Git - php/commitdiff
Fixed bug #48757 (ReflectionFunction::invoke() parameter issues)
authorKalle Sommer Nielsen <kalle@php.net>
Wed, 1 Jul 2009 17:37:42 +0000 (17:37 +0000)
committerKalle Sommer Nielsen <kalle@php.net>
Wed, 1 Jul 2009 17:37:42 +0000 (17:37 +0000)
ext/reflection/php_reflection.c
ext/reflection/tests/bug48757.phpt [new file with mode: 0644]

index 8c586cf752c66b6e2511a34ffbb3a6f403e1cea5..c22583b80c5dd95146443a27a78cf5eaac47efd5 100644 (file)
@@ -1763,7 +1763,7 @@ ZEND_METHOD(reflection_function, getClosure)
 }
 /* }}} */
 
-/* {{{ proto public mixed ReflectionFunction::invoke(mixed* args) U
+/* {{{ proto public mixed ReflectionFunction::invoke([mixed* args]) U
    Invokes the function */
 ZEND_METHOD(reflection_function, invoke)
 {
@@ -1778,7 +1778,7 @@ ZEND_METHOD(reflection_function, invoke)
        METHOD_NOTSTATIC(reflection_function_ptr);
        GET_REFLECTION_OBJECT_PTR(fptr);
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &params, &num_args) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "*", &params, &num_args) == FAILURE) {
                return;
        }
 
@@ -5249,7 +5249,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_function___construct, 0)
        ZEND_ARG_INFO(0, name)
 ZEND_END_ARG_INFO()
 
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_function_invoke, 0)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_function_invoke, 0, 0, 0)
        ZEND_ARG_INFO(0, args)
 ZEND_END_ARG_INFO()
 
diff --git a/ext/reflection/tests/bug48757.phpt b/ext/reflection/tests/bug48757.phpt
new file mode 100644 (file)
index 0000000..939349f
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+Bug #48757 (ReflectionFunction::invoke() parameter issues)
+--FILE--
+<?php
+function test() {
+       echo "Hello World\n";
+}
+
+function another_test($parameter) {
+       var_dump($parameter);
+}
+
+$func = new ReflectionFunction('test');
+$func->invoke();
+
+$func = new ReflectionFunction('another_test');
+$func->invoke('testing');
+?>
+--EXPECT--
+Hello World
+unicode(7) "testing"