Skip to content

Commit 4ca94ee

Browse files
committed
ext/soap: Add tests for invalid SOAP Headers argument
1 parent 582ccff commit 4ca94ee

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--TEST--
2+
SoapClient::__soapCall with invalid headers
3+
--EXTENSIONS--
4+
soap
5+
--FILE--
6+
<?php
7+
8+
/* Bypass constructor */
9+
class ExtendedSoapClient extends SoapClient {
10+
public function __construct() {}
11+
}
12+
13+
$client = new ExtendedSoapClient();
14+
$header = new SoapHeader('namespace', 'name');
15+
$headers = [
16+
$header,
17+
'giberrish',
18+
];
19+
20+
try {
21+
$client->__setSoapHeaders($headers);
22+
} catch (Throwable $e) {
23+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
24+
}
25+
26+
?>
27+
--EXPECTF--
28+
Fatal error: SoapClient::__setSoapHeaders(): Invalid SOAP header in %s on line %d
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--TEST--
2+
SoapClient::__soapCall with invalid headers
3+
--EXTENSIONS--
4+
soap
5+
--FILE--
6+
<?php
7+
8+
/* Bypass constructor */
9+
class ExtendedSoapClient extends SoapClient {
10+
public function __construct() {}
11+
}
12+
13+
$client = new ExtendedSoapClient();
14+
$header = new SoapHeader('namespace', 'name');
15+
$headers = [
16+
$header,
17+
'giberrish',
18+
];
19+
20+
try {
21+
$client->__soapCall('function', ['arg'], ['options'], $headers);
22+
} catch (Throwable $e) {
23+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
24+
}
25+
26+
?>
27+
--EXPECTF--
28+
Fatal error: SoapClient::__soapCall(): Invalid SOAP header in %s on line %d

0 commit comments

Comments
 (0)