mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
afc4d67c8b
There was a loophole here when it came to usage with named arguments, which was not intended. Close the loophole thoroughly by actually dropping the default value from the signature entirely. The default is still used to make the type nullable, but not for anything else.
18 lines
404 B
PHP
18 lines
404 B
PHP
--TEST--
|
|
Optional param before required should be treated as required for named args as well
|
|
--FILE--
|
|
<?php
|
|
|
|
function test($a = 1, $b) {
|
|
}
|
|
try {
|
|
test(b: 2);
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Deprecated: Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in %s on line %d
|
|
test(): Argument #1 ($a) not passed
|