]> granicus.if.org Git - php/commitdiff
Fix php_get_args function info return type and add arg check
authorIlija Tovilo <ilija.tovilo@me.com>
Sat, 30 May 2020 21:33:25 +0000 (23:33 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Sun, 31 May 2020 15:15:58 +0000 (17:15 +0200)
Closes GH-5648.

Zend/tests/bug72107.phpt
Zend/zend_builtin_functions.c
ext/opcache/Optimizer/zend_func_info.c

index c22f657ebbca1e06def1945df172878568a4a58b..b37ecf0849a48de935370cc094c6daf661d6b607 100644 (file)
@@ -13,4 +13,4 @@ try {
 }
 ?>
 --EXPECT--
-Cannot call func_get_args() dynamically
+func_get_args() expects exactly 0 parameters, 4 given
index 9062cf6f5c3cf7e8c2dd47fbac278dc4035400a2..775bab1504a3f250b109f0f683af34a93483ef2a 100644 (file)
@@ -231,6 +231,8 @@ ZEND_FUNCTION(func_get_args)
        uint32_t i;
        zend_execute_data *ex = EX(prev_execute_data);
 
+       ZEND_PARSE_PARAMETERS_NONE();
+
        if (ZEND_CALL_INFO(ex) & ZEND_CALL_CODE) {
                zend_throw_error(NULL, "func_get_args() cannot be called from the global scope");
                RETURN_THROWS();
index 6b013f76146e0771df98eea241432026b0a9208d..3b9ebf75ab53514b898caf62f0ebc4459dd8ca9d 100644 (file)
@@ -94,7 +94,7 @@ static const func_info_t func_infos[] = {
        /* zend */
        F1("zend_version",            MAY_BE_STRING),
        FN("func_get_arg",            UNKNOWN_INFO),
-       FN("func_get_args",           MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
+       FN("func_get_args",           MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
        F1("get_class_vars",          MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
        FN("get_object_vars",         MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
        FN("get_mangled_object_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),