mirror of
https://github.com/php/php-src.git
synced 2026-04-23 07:58:20 +02:00
d92229d8c7
From an engine perspective, named parameters mainly add three concepts: * The SEND_* opcodes now accept a CONST op2, which is the argument name. For now, it is looked up by linear scan and runtime cached. * This may leave UNDEF arguments on the stack. To avoid having to deal with them in other places, a CHECK_UNDEF_ARGS opcode is used to either replace them with defaults, or error. * For variadic functions, EX(extra_named_params) are collected and need to be freed based on ZEND_CALL_HAS_EXTRA_NAMED_PARAMS. RFC: https://wiki.php.net/rfc/named_params Closes GH-5357.
22 lines
478 B
PHP
22 lines
478 B
PHP
--TEST--
|
|
Named params on internal functions: Variadic functions that don't support extra named args
|
|
--FILE--
|
|
<?php
|
|
|
|
try {
|
|
array_merge([1, 2], a: [3, 4]);
|
|
} catch (ArgumentCountError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
try {
|
|
array_diff_key([1, 2], [3, 4], a: [5, 6]);
|
|
} 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
|