Skip to content

Commit

Permalink
Reset required_num_args for disabled functions
Browse files Browse the repository at this point in the history
Otherwise we may get arginfo/zpp mismatch errors.
  • Loading branch information
nikic committed Feb 12, 2020
1 parent ae6f45a commit 907ae8d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Zend/tests/bug69315.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ var_dump(defined("PHP_VERSION"));
var_dump(constant("PHP_VERSION"));
var_dump(call_user_func("strlen"));
var_dump(is_string("xxx"));
var_dump(is_string());

?>
--EXPECTF--
bool(false)
bool(true)
Expand All @@ -30,3 +33,6 @@ NULL

Warning: is_string() has been disabled for security reasons in %sbug69315.php on line %d
NULL

Warning: is_string() has been disabled for security reasons in %s on line %d
NULL
1 change: 1 addition & 0 deletions Zend/zend_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -2650,6 +2650,7 @@ ZEND_API int zend_disable_function(char *function_name, size_t function_name_len
zend_free_internal_arg_info(func);
func->fn_flags &= ~(ZEND_ACC_VARIADIC | ZEND_ACC_HAS_TYPE_HINTS | ZEND_ACC_HAS_RETURN_TYPE);
func->num_args = 0;
func->required_num_args = 0;
func->arg_info = NULL;
func->handler = ZEND_FN(display_disabled_function);
return SUCCESS;
Expand Down

0 comments on commit 907ae8d

Please sign in to comment.