summaryrefslogtreecommitdiff
path: root/Zend/tests/named_params/missing_param.phpt
blob: f8b0b356ceebc7db1b382b1e19937a8b94401b2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--TEST--
Required parameter not passed
--FILE--
<?php

function test($a, $b, $c, $d) {
}

try {
    test(a: 'a', d: 'd');
} catch (ArgumentCountError $e) {
    echo $e->getMessage(), "\n";
}

try {
    array_keys(strict: true);
} catch (ArgumentCountError $e) {
    echo $e->getMessage(), "\n";
}

try {
    array_keys([], strict: true);
} catch (ArgumentCountError $e) {
    echo $e->getMessage(), "\n";
}

// This works fine, as search_value is explicitly specified.
var_dump(array_keys([41, 42], filter_value: 42, strict: true));

?>
--EXPECT--
test(): Argument #2 ($b) not passed
array_keys(): Argument #1 ($array) not passed
array_keys(): Argument #2 ($filter_value) must be passed explicitly, because the default value is not known
array(1) {
  [0]=>
  int(1)
}