Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Zend/zend_execute_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,37 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_

ZEND_ASSERT((consumed_args & (consumed_args - 1)) == 0);

if (!consumed_args && !fci->named_params) {
switch (fci->param_count) {
case 2:
if (UNEXPECTED(QUICK_ARG_SHOULD_BE_SENT_BY_REF(func, 2) || Z_ISUNDEF(fci->params[1]))) {
break;
}
ZEND_FALLTHROUGH;
case 1:
if (UNEXPECTED(QUICK_ARG_SHOULD_BE_SENT_BY_REF(func, 1) || Z_ISUNDEF(fci->params[0]))) {
break;
}

if (!(func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
ZVAL_COPY_DEREF(ZEND_CALL_ARG(call, 1), &fci->params[0]);
if (fci->param_count == 2) {
ZVAL_COPY_DEREF(ZEND_CALL_ARG(call, 2), &fci->params[1]);
}
} else {
/* Don't separate references for __call */
ZVAL_COPY(ZEND_CALL_ARG(call, 1), &fci->params[0]);
if (fci->param_count == 2) {
ZVAL_COPY(ZEND_CALL_ARG(call, 2), &fci->params[1]);
}
}

ZEND_FALLTHROUGH;
case 0:
goto args_prepared;
}
}

for (uint32_t i = 0; i < fci->param_count; i++) {
zval *param = ZEND_CALL_ARG(call, i+1);
zval *arg = &fci->params[i];
Expand Down Expand Up @@ -1053,6 +1084,7 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_
}
}

args_prepared:
if (UNEXPECTED(func->op_array.fn_flags & ZEND_ACC_CLOSURE)) {
uint32_t call_info;

Expand Down
Loading