diff --git a/Zend/Optimizer/sccp.c b/Zend/Optimizer/sccp.c index 40790385e6a39..554abcfd65aa7 100644 --- a/Zend/Optimizer/sccp.c +++ b/Zend/Optimizer/sccp.c @@ -1801,8 +1801,9 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o break; } - /* We're only interested in functions with up to three arguments right now */ - if (call->num_args > 3 || call->send_unpack || call->is_prototype) { + /* We're only interested in functions with up to three arguments right now. + * Note that named arguments with the argument in declaration order will still work. */ + if (call->num_args > 3 || call->send_unpack || call->is_prototype || call->named_args) { SET_RESULT_BOT(result); break; } diff --git a/ext/opcache/tests/opt/gh10801.phpt b/ext/opcache/tests/opt/gh10801.phpt new file mode 100644 index 0000000000000..7260c1c40c11e --- /dev/null +++ b/ext/opcache/tests/opt/gh10801.phpt @@ -0,0 +1,22 @@ +--TEST-- +GH-10801 (Named arguments in CTE functions cause a segfault) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=0xe0 +--EXTENSIONS-- +opcache +--FILE-- + 1], strict: true, filter_value: 0)); +// Will not use named arguments and do CTE as expected +print_r(array_keys(array: [1 => 1], filter_value: 0, strict: true)); +?> +--EXPECT-- +Array +( +) +Array +( +)