-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Expand file tree
/
Copy pathclassmap_invalid_keys.phpt
More file actions
68 lines (62 loc) · 1.9 KB
/
Copy pathclassmap_invalid_keys.phpt
File metadata and controls
68 lines (62 loc) · 1.9 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
--TEST--
SoapClient and SoapServer classmap options must only contain string keys
--EXTENSIONS--
soap
--FILE--
<?php
$emptyHash = ['type' => 'stdClass'];
unset($emptyHash['type']);
$cases = [
'empty' => [],
'empty hash' => $emptyHash,
'packed' => ['stdClass'],
'sparse numeric' => [100 => 'stdClass'],
'numeric string' => ['1' => 'stdClass'],
'mixed' => ['type' => 'stdClass', 1 => 'stdClass'],
'associative' => ['type' => 'stdClass'],
];
foreach ($cases as $name => $classmap) {
echo "-- $name --\n";
try {
new SoapClient(null, [
'location' => 'http://example.com/',
'uri' => 'urn:test',
'classmap' => $classmap,
]);
echo "SoapClient: OK\n";
} catch (Throwable $e) {
echo $e->getMessage(), "\n";
}
try {
new SoapServer(null, [
'uri' => 'urn:test',
'classmap' => $classmap,
]);
echo "SoapServer: OK\n";
} catch (Throwable $e) {
echo $e->getMessage(), "\n";
}
}
?>
--EXPECT--
-- empty --
SoapClient: OK
SoapServer: OK
-- empty hash --
SoapClient: OK
SoapServer: OK
-- packed --
SoapClient::__construct(): 'classmap' option must be an associative array
SoapServer::__construct(): Argument #2 ($options) "classmap" option must be an associative array
-- sparse numeric --
SoapClient::__construct(): 'classmap' option must be an associative array
SoapServer::__construct(): Argument #2 ($options) "classmap" option must be an associative array
-- numeric string --
SoapClient::__construct(): 'classmap' option must be an associative array
SoapServer::__construct(): Argument #2 ($options) "classmap" option must be an associative array
-- mixed --
SoapClient::__construct(): 'classmap' option must be an associative array
SoapServer::__construct(): Argument #2 ($options) "classmap" option must be an associative array
-- associative --
SoapClient: OK
SoapServer: OK