mirror of
https://github.com/php/php-src.git
synced 2024-11-30 21:35:36 +08:00
Fix over-eager named params optimization
We can't relax a named param to a positional param if we encountered any unknown parameters in the meantime.
This commit is contained in:
parent
f593019819
commit
1954aed745
@ -15,6 +15,12 @@ try {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
try {
|
||||
test(b: 2, a: 1);
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
try {
|
||||
test2(a: 42);
|
||||
} catch (Error $e) {
|
||||
@ -24,3 +30,4 @@ try {
|
||||
?>
|
||||
--EXPECT--
|
||||
Unknown named parameter $b
|
||||
Unknown named parameter $b
|
||||
|
@ -3369,7 +3369,7 @@ uint32_t zend_compile_args(
|
||||
|
||||
if (fbc) {
|
||||
arg_num = zend_get_arg_num(fbc, arg_name);
|
||||
if (arg_num == arg_count + 1) {
|
||||
if (arg_num == arg_count + 1 && !may_have_undef) {
|
||||
/* Using named arguments, but passing in order. */
|
||||
arg_name = NULL;
|
||||
arg_count++;
|
||||
|
Loading…
Reference in New Issue
Block a user