[php-src] master: Merge branch 'PHP-8.6'

From: Date: Thu, 29 Oct 2026 09:58:03 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142934@lists.php.net to get a copy of this message
Author: Arnaud Le Blanc (arnaud-lb) Date: 2026-10-29T10:57:48+01:00 Commit: https://github.com/php/php-src/commit/3726b925d55389e2f7205316d080865352221de5 Raw diff: https://github.com/php/php-src/commit/3726b925d55389e2f7205316d080865352221de5.diff Merge branch 'PHP-8.6' * PHP-8.6: Fix GH-25007: PFA named args in constant expression write out of bounds (#25012) Changed paths: A Zend/tests/partial_application/gh25007.phpt M Zend/zend_ast.c Diff: diff --git a/Zend/tests/partial_application/gh25007.phpt b/Zend/tests/partial_application/gh25007.phpt new file mode 100644 index 000000000000..99899a615778 --- /dev/null +++ b/Zend/tests/partial_application/gh25007.phpt @@ -0,0 +1,31 @@ +--TEST-- +GH-25007 (PFA in constexpr: named args before a named placeholder) +--FILE-- +<?php + +function f($a, $b = 2, $c = 3) { + var_dump(func_get_args()); +} + +const C1 = f(a: 1, b: ?); +const C2 = f(a: 1, c: ?, b: ?); + +(C1)(4); +(C2)(5, 6); + +?> +--EXPECT-- +array(2) { + [0]=> + int(1) + [1]=> + int(4) +} +array(3) { + [0]=> + int(1) + [1]=> + int(6) + [2]=> + int(5) +} diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index e6b7dd32e28c..e55a90001d2d 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -701,14 +701,6 @@ static zend_execute_data *zend_ast_evaluate_arg_list( if (!arg) { goto fail; } - if (named_positions_ptr) { - if (!*named_positions_ptr) { - *named_positions_ptr = zend_new_array(0); - } - zval tmp; - ZVAL_LONG(&tmp, zend_hash_num_elements(*named_positions_ptr)); - zend_hash_add(*named_positions_ptr, arg_name, &tmp); - } arg_ast = arg_ast->child[1]; } else { arg = ZEND_CALL_VAR_NUM(frame, ZEND_CALL_NUM_ARGS(frame)); @@ -724,6 +716,14 @@ static zend_execute_data *zend_ast_evaluate_arg_list( } else { Z_TYPE_INFO_P(arg) = _IS_PLACEHOLDER; } + if (arg_name && named_positions_ptr) { + if (!*named_positions_ptr) { + *named_positions_ptr = zend_new_array(0); + } + zval tmp; + ZVAL_LONG(&tmp, zend_hash_num_elements(*named_positions_ptr)); + zend_hash_add(*named_positions_ptr, arg_name, &tmp); + } } else { if (zend_ast_evaluate_ex(arg, arg_ast, scope, short_circuited_ptr, ctx) == FAILURE) { ZVAL_UNDEF(arg);

« previous php.cvs (#142934) next »