Skip to content

Commit

Permalink
Fix assertion failure in cufa optimization with named args
Browse files Browse the repository at this point in the history
Fixes oss-fuzz#30764.
  • Loading branch information
nikic committed Feb 15, 2021
1 parent 8b9dd0a commit c702202
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Zend/tests/call_user_func_array_array_slice_named_args.phpt
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

if (zend_string_equals_literal_ci(name, "array_slice")
&& !zend_args_contain_unpack_or_named(list)
&& list->children == 3
&& list->child[1]->kind == ZEND_AST_ZVAL) {
zval *zv = zend_ast_get_zval(list->child[1]);
Expand Down

0 comments on commit c702202

Please sign in to comment.