Merge branch 'PHP-8.1'

* PHP-8.1:
  Fix memory leaks
This commit is contained in:
Dmitry Stogov 2022-08-22 17:54:36 +03:00
commit a44fb09620
2 changed files with 16 additions and 1 deletions

View File

@ -0,0 +1,13 @@
--TEST--
call_user_func_array() with extra named parameters
--FILE--
<?php
$args = array("" => 1);
call_user_func_array("array_multisort", $args);
?>
--EXPECTF--
Fatal error: Uncaught ArgumentCountError: array_multisort() expects at least 1 argument, 0 given in %scall_user_func_array_variadic.php:3
Stack trace:
#0 %scall_user_func_array_variadic.php(3): array_multisort(: 1)
#1 {main}
thrown in %scall_user_func_array_variadic.php on line 3

View File

@ -3987,6 +3987,7 @@ static void zend_compile_init_user_func(zend_ast *name_ast, uint32_t num_args, z
static zend_result zend_compile_func_cufa(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */
{
znode arg_node;
zend_op *opline;
if (args->children != 2) {
return FAILURE;
@ -4028,7 +4029,8 @@ static zend_result zend_compile_func_cufa(znode *result, zend_ast_list *args, ze
zend_compile_expr(&arg_node, args->child[1]);
zend_emit_op(NULL, ZEND_SEND_ARRAY, &arg_node, NULL);
zend_emit_op(NULL, ZEND_CHECK_UNDEF_ARGS, NULL, NULL);
zend_emit_op(result, ZEND_DO_FCALL, NULL, NULL);
opline = zend_emit_op(result, ZEND_DO_FCALL, NULL, NULL);
opline->extended_value = ZEND_FCALL_MAY_HAVE_EXTRA_NAMED_PARAMS;
return SUCCESS;
}