Skip to content

Commit c702202

Browse files
committed
Fix assertion failure in cufa optimization with named args
Fixes oss-fuzz#30764.
1 parent 8b9dd0a commit c702202

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--TEST--
2+
call_user_func_array() + array_slice() + named arguments
3+
--FILE--
4+
<?php
5+
call_user_func_array('func', array_slice(array: $a, 1, 2));
6+
?>
7+
--EXPECTF--
8+
Fatal error: Cannot use positional argument after named argument in %s on line %d

Zend/zend_compile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3878,6 +3878,7 @@ zend_result zend_compile_func_cufa(znode *result, zend_ast_list *args, zend_stri
38783878
zend_string *name = zend_resolve_function_name(orig_name, args->child[1]->child[0]->attr, &is_fully_qualified);
38793879

38803880
if (zend_string_equals_literal_ci(name, "array_slice")
3881+
&& !zend_args_contain_unpack_or_named(list)
38813882
&& list->children == 3
38823883
&& list->child[1]->kind == ZEND_AST_ZVAL) {
38833884
zval *zv = zend_ast_get_zval(list->child[1]);

0 commit comments

Comments
 (0)