[php-src] master: Follow-up GH-22829

Arnaud Le Blanc <[email protected]> Tue, 28 Jul 2026 16:30:58 +0000
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Arnaud Le Blanc (arnaud-lb)
Date: 2026-07-28T18:30:44+02:00

Commit: https://github.com/php/php-src/commit/a652a00c02a4d7aa5bb6f7939aa2628b64dfbad5
Raw diff: https://github.com/php/php-src/commit/a652a00c02a4d7aa5bb6f7939aa2628b64dfbad5.diff

Follow-up GH-22829

Changed paths:
  M  Zend/Optimizer/dfa_pass.c
  M  Zend/tests/partial_application/const_arg_opt.phpt
  M  Zend/zend_ast.c


Diff:

diff --git a/Zend/Optimizer/dfa_pass.c b/Zend/Optimizer/dfa_pass.c
index dcb4e8bc8412..8826ca41641f 100644
--- a/Zend/Optimizer/dfa_pass.c
+++ b/Zend/Optimizer/dfa_pass.c
@@ -471,7 +471,7 @@ static uint32_t zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa)
 			}
 
 			if (call_info->caller_call_opline && call_info->caller_call_opline->opcode == ZEND_CALLABLE_CONVERT_PARTIAL) {
-				/* Build a bitset of constant pre-bound PFA args: These are args whose value is alway the same for all
+				/* Build a bitset of constant pre-bound PFA args: These are args whose value is always the same for all
 				 * instances of a PFA. */
 				uint32_t const_args = 0;
 				for (uint32_t i = 0, l = MIN(sizeof(const_args)*CHAR_BIT, call_info->num_args); i < l; i++) {
diff --git a/Zend/tests/partial_application/const_arg_opt.phpt b/Zend/tests/partial_application/const_arg_opt.phpt
index d63456a96a5d..4b3afd1c2d2a 100644
--- a/Zend/tests/partial_application/const_arg_opt.phpt
+++ b/Zend/tests/partial_application/const_arg_opt.phpt
@@ -46,12 +46,12 @@ $f(2);
 echo "# Constant pre-bound argument:\n";
 $f = f(2, ?);
 print_lexical_vars($f);
-$f(2);
+$f(1);
 
 echo "# Constant pre-bound argument (inverted):\n";
-$f = f(?, 2);
+$f = f(?, 3);
 print_lexical_vars($f);
-$f(1);
+$f(4);
 
 echo "# Inlined pre-bound argument:\n";
 $f = f(g(), ?);
@@ -100,15 +100,15 @@ array(2) {
   [0]=>
   int(2)
   [1]=>
-  int(2)
+  int(1)
 }
 # Constant pre-bound argument (inverted):
 no lexical vars
 array(2) {
   [0]=>
-  int(1)
+  int(4)
   [1]=>
-  int(2)
+  int(3)
 }
 # Inlined pre-bound argument:
 no lexical vars
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c
index a17cb3d91b91..a91f0d2c933a 100644
--- a/Zend/zend_ast.c
+++ b/Zend/zend_ast.c
@@ -1352,7 +1352,7 @@ static zend_result ZEND_FASTCALL zend_ast_evaluate_inner(
 					ZEND_CALL_NUM_ARGS(frame), ZEND_CALL_ARG(frame, 1),
 					extra_named_params, named_positions,
 					fcc_ast->filename, &ast->lineno,
-					(void**)cache_slot, fcc_ast->name, flags, 0);
+					(void**)cache_slot, fcc_ast->name, flags, /* const_args */ 0);
 
 			if (named_positions) {
 				zend_array_release(named_positions);