Skip to content

Commit 5a0b4e4

Browse files
committed
Make compiler code a bit smarter
1 parent 3621a19 commit 5a0b4e4

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Zend/zend_compile.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3349,7 +3349,9 @@ uint32_t zend_compile_args(
33493349

33503350
/* Unpack may contain named arguments. */
33513351
may_have_undef = 1;
3352-
*may_have_extra_named_args = 1;
3352+
if (!fbc || (fbc->common.fn_flags & ZEND_ACC_VARIADIC)) {
3353+
*may_have_extra_named_args = 1;
3354+
}
33533355
continue;
33543356
}
33553357

@@ -3369,13 +3371,15 @@ uint32_t zend_compile_args(
33693371
/* Using named arguments, but passing in order. */
33703372
arg_name = NULL;
33713373
arg_count++;
3374+
} else {
3375+
// TODO: We could track which arguments were passed, even if out of order.
3376+
may_have_undef = 1;
3377+
if (arg_num == (uint32_t) -1 && (fbc->common.fn_flags & ZEND_ACC_VARIADIC)) {
3378+
*may_have_extra_named_args = 1;
3379+
}
33723380
}
33733381
} else {
33743382
arg_num = (uint32_t) -1;
3375-
}
3376-
3377-
if (arg_name) {
3378-
// TODO: These could be made more precise if fbc is known.
33793383
may_have_undef = 1;
33803384
*may_have_extra_named_args = 1;
33813385
}

0 commit comments

Comments
 (0)