Skip to content

Commit c599d17

Browse files
iluuu1994nikic
authored andcommitted
Fix php_get_args function info return type and add arg check
Closes phpGH-5648.
1 parent eeb7a7c commit c599d17

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

Zend/tests/bug72107.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ try {
1313
}
1414
?>
1515
--EXPECT--
16-
Cannot call func_get_args() dynamically
16+
func_get_args() expects exactly 0 parameters, 4 given

Zend/zend_builtin_functions.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ ZEND_FUNCTION(func_get_args)
231231
uint32_t i;
232232
zend_execute_data *ex = EX(prev_execute_data);
233233

234+
ZEND_PARSE_PARAMETERS_NONE();
235+
234236
if (ZEND_CALL_INFO(ex) & ZEND_CALL_CODE) {
235237
zend_throw_error(NULL, "func_get_args() cannot be called from the global scope");
236238
RETURN_THROWS();

ext/opcache/Optimizer/zend_func_info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static const func_info_t func_infos[] = {
9494
/* zend */
9595
F1("zend_version", MAY_BE_STRING),
9696
FN("func_get_arg", UNKNOWN_INFO),
97-
FN("func_get_args", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
97+
FN("func_get_args", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
9898
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),
9999
FN("get_object_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
100100
FN("get_mangled_object_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),

0 commit comments

Comments
 (0)