Skip to content

Commit 907ae8d

Browse files
committed
Reset required_num_args for disabled functions
Otherwise we may get arginfo/zpp mismatch errors.
1 parent ae6f45a commit 907ae8d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Zend/tests/bug69315.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ var_dump(defined("PHP_VERSION"));
1212
var_dump(constant("PHP_VERSION"));
1313
var_dump(call_user_func("strlen"));
1414
var_dump(is_string("xxx"));
15+
var_dump(is_string());
16+
17+
?>
1518
--EXPECTF--
1619
bool(false)
1720
bool(true)
@@ -30,3 +33,6 @@ NULL
3033

3134
Warning: is_string() has been disabled for security reasons in %sbug69315.php on line %d
3235
NULL
36+
37+
Warning: is_string() has been disabled for security reasons in %s on line %d
38+
NULL

Zend/zend_API.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,6 +2650,7 @@ ZEND_API int zend_disable_function(char *function_name, size_t function_name_len
26502650
zend_free_internal_arg_info(func);
26512651
func->fn_flags &= ~(ZEND_ACC_VARIADIC | ZEND_ACC_HAS_TYPE_HINTS | ZEND_ACC_HAS_RETURN_TYPE);
26522652
func->num_args = 0;
2653+
func->required_num_args = 0;
26532654
func->arg_info = NULL;
26542655
func->handler = ZEND_FN(display_disabled_function);
26552656
return SUCCESS;

0 commit comments

Comments
 (0)