1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

chore: improve errror message when passing named parameter for variadic in unsupported internal functions (#21012)

This commit is contained in:
Jorg Adam Sowa
2026-01-25 19:27:57 +01:00
committed by GitHub
parent 5f367b8a01
commit 9f774e3a85
2 changed files with 12 additions and 4 deletions

View File

@@ -15,7 +15,14 @@ try {
echo $e->getMessage(), "\n";
}
try {
$array = [1, 2];
array_push($array, ...['values' => 3]);
} catch (ArgumentCountError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
array_merge() does not accept unknown named parameters
array_diff_key() does not accept unknown named parameters
Internal function array_merge() does not accept named variadic arguments
Internal function array_diff_key() does not accept named variadic arguments
Internal function array_push() does not accept named variadic arguments

View File

@@ -370,8 +370,9 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_unexpected_extra_named_error(void)
{
const char *space;
const char *class_name = get_active_class_name(&space);
zend_argument_count_error("%s%s%s() does not accept unknown named parameters",
class_name, space, get_active_function_name());
zend_argument_count_error("Internal function %s%s%s() does not accept named variadic arguments",
class_name, space, get_active_function_name()
);
}
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_argument_error_variadic(zend_class_entry *error_ce, uint32_t arg_num, const char *format, va_list va) /* {{{ */