Category
Language · php-src-strict
Problem
When a call passes the same named parameter twice (f(a: 1, a: 2)), Zend raises a runtime Error that user code can catch. This compiler rejects the call at compile time (parseAndCompile failure: Named parameter $a overwrites previous argument), so catch blocks never run and exit semantics differ.
| Repro |
Zend 8.2+ |
VM (2026-07-05) |
try { sum(a:1,a:2,b:3); } catch (Error $e) { echo 'ok'; } |
ok:Named parameter $a overwrites previous argument |
compile failure (exit ≠ 0, body not executed) |
php-src reference
PHP implementation target
lib/Compiler.php — defer duplicate named-parameter detection to runtime call path (or emit VM opcode that matches Zend timing); align JIT/AOT call lowering with VM
- Reuse shared named-arg helpers; no new
runtime/*.c branches
Repro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_duplicate_named_argument.php'
# Zend baseline (prints ok:…):
php test/repro/maintainer_gap_duplicate_named_argument.php
Done when
Category
Language· php-src-strictProblem
When a call passes the same named parameter twice (
f(a: 1, a: 2)), Zend raises a runtimeErrorthat user code can catch. This compiler rejects the call at compile time (parseAndCompile failure: Named parameter $a overwrites previous argument), so catch blocks never run and exit semantics differ.try { sum(a:1,a:2,b:3); } catch (Error $e) { echo 'ok'; }ok:Named parameter $a overwrites previous argumentphp-src reference
Zend/zend_execute.c—zend_verify_arg_error/ named-arg overwrite at call timeZend/zend_compile.c— named parameter bindingPHP implementation target
lib/Compiler.php— defer duplicate named-parameter detection to runtime call path (or emit VM opcode that matches Zend timing); align JIT/AOT call lowering with VMruntime/*.cbranchesRepro
Done when
test/repro/maintainer_gap_duplicate_named_argument.phpprintsok:on VM and exit 0.phptguard undertest/compliance/cases/language/duplicate_named_argument.phpt