Skip to content

Commit 298806e

Browse files
committed
Check for duplicate parameter names in internal functions
1 parent a3fdd25 commit 298806e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Zend/zend_API.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2314,11 +2314,20 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
23142314
if (reg_function->common.arg_info && reg_function->common.num_args) {
23152315
uint32_t i;
23162316
for (i = 0; i < reg_function->common.num_args; i++) {
2317-
zend_arg_info *arg_info = &reg_function->common.arg_info[i];
2317+
zend_internal_arg_info *arg_info = &reg_function->internal_function.arg_info[i];
23182318
ZEND_ASSERT(arg_info->name && "Parameter must have a name");
23192319
if (ZEND_TYPE_IS_SET(arg_info->type)) {
23202320
reg_function->common.fn_flags |= ZEND_ACC_HAS_TYPE_HINTS;
23212321
}
2322+
#if ZEND_DEBUG
2323+
for (uint32_t j = 0; j < i; j++) {
2324+
if (!strcmp(arg_info->name, reg_function->internal_function.arg_info[j].name)) {
2325+
zend_error_noreturn(E_CORE_ERROR,
2326+
"Duplicate parameter name $%s for function %s%s%s()", arg_info->name,
2327+
scope ? ZSTR_VAL(scope->name) : "", scope ? "::" : "", ptr->fname);
2328+
}
2329+
}
2330+
#endif
23222331
}
23232332
}
23242333

0 commit comments

Comments
 (0)