Fix assertion failure in cufa optimization with named args

Fixes oss-fuzz#30764.
This commit is contained in:
Nikita Popov 2021-02-15 12:42:48 +01:00
parent 8b9dd0a301
commit c70220205e
2 changed files with 9 additions and 0 deletions

View file

@ -0,0 +1,8 @@
--TEST--
call_user_func_array() + array_slice() + named arguments
--FILE--
<?php
call_user_func_array('func', array_slice(array: $a, 1, 2));
?>
--EXPECTF--
Fatal error: Cannot use positional argument after named argument in %s on line %d

View file

@ -3878,6 +3878,7 @@ zend_result zend_compile_func_cufa(znode *result, zend_ast_list *args, zend_stri
zend_string *name = zend_resolve_function_name(orig_name, args->child[1]->child[0]->attr, &is_fully_qualified); zend_string *name = zend_resolve_function_name(orig_name, args->child[1]->child[0]->attr, &is_fully_qualified);
if (zend_string_equals_literal_ci(name, "array_slice") if (zend_string_equals_literal_ci(name, "array_slice")
&& !zend_args_contain_unpack_or_named(list)
&& list->children == 3 && list->children == 3
&& list->child[1]->kind == ZEND_AST_ZVAL) { && list->child[1]->kind == ZEND_AST_ZVAL) {
zval *zv = zend_ast_get_zval(list->child[1]); zval *zv = zend_ast_get_zval(list->child[1]);