Skip to content

Commit cf8d7b3

Browse files
committed
Don't handle missing value in zend_verify_arg_error()
This error condition is handled separately, never reaches this function.
1 parent 5b78d76 commit cf8d7b3

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

Zend/zend_execute.c

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -685,33 +685,29 @@ ZEND_API ZEND_COLD void zend_verify_arg_error(
685685
return;
686686
}
687687

688-
if (value) {
689-
zend_verify_type_error_common(
690-
zf, arg_info, value, &fname, &fsep, &fclass, &need_msg, &given_msg);
691-
692-
if (zf->common.type == ZEND_USER_FUNCTION) {
693-
if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) {
694-
zend_type_error("%s%s%s(): Argument #%d ($%s) must be of type %s, %s given, called in %s on line %d",
695-
fclass, fsep, fname,
696-
arg_num, ZSTR_VAL(arg_info->name),
697-
ZSTR_VAL(need_msg), given_msg,
698-
ZSTR_VAL(ptr->func->op_array.filename), ptr->opline->lineno
699-
);
700-
} else {
701-
zend_type_error("%s%s%s(): Argument #%d ($%s) must be of type %s, %s given",
702-
fclass, fsep, fname, arg_num, ZSTR_VAL(arg_info->name), ZSTR_VAL(need_msg), given_msg
703-
);
704-
}
688+
zend_verify_type_error_common(
689+
zf, arg_info, value, &fname, &fsep, &fclass, &need_msg, &given_msg);
690+
691+
if (zf->common.type == ZEND_USER_FUNCTION) {
692+
if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) {
693+
zend_type_error("%s%s%s(): Argument #%d ($%s) must be of type %s, %s given, called in %s on line %d",
694+
fclass, fsep, fname,
695+
arg_num, ZSTR_VAL(arg_info->name),
696+
ZSTR_VAL(need_msg), given_msg,
697+
ZSTR_VAL(ptr->func->op_array.filename), ptr->opline->lineno
698+
);
705699
} else {
706700
zend_type_error("%s%s%s(): Argument #%d ($%s) must be of type %s, %s given",
707-
fclass, fsep, fname, arg_num, ((zend_internal_arg_info*) arg_info)->name, ZSTR_VAL(need_msg), given_msg
701+
fclass, fsep, fname, arg_num, ZSTR_VAL(arg_info->name), ZSTR_VAL(need_msg), given_msg
708702
);
709703
}
710-
711-
zend_string_release(need_msg);
712704
} else {
713-
zend_missing_arg_error(ptr);
705+
zend_type_error("%s%s%s(): Argument #%d ($%s) must be of type %s, %s given",
706+
fclass, fsep, fname, arg_num, ((zend_internal_arg_info*) arg_info)->name, ZSTR_VAL(need_msg), given_msg
707+
);
714708
}
709+
710+
zend_string_release(need_msg);
715711
}
716712

717713
static zend_bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg)

0 commit comments

Comments
 (0)