Skip to content

Commit e1b59e9

Browse files
committed
ext/soap: Use more accurate return types in implementations of SoapClient::__doRequest()
The do_request() function that calls this methods, assumes that a string is being returned from the method otherwise it bails out. However, the default implementation of SoapClient::__doRequest() indicates that it can return null when it fails to set-up and execute the HTTP SOAP request, but this always results in a SoapFault exception being thrown, and thus cannot happen in practice. We need to investigate further if the return type should be changed from ?string to string or not.
1 parent 0fc5ec1 commit e1b59e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+67
-61
lines changed

ext/soap/tests/any.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class TestSoapClient extends SoapClient {
3333
$this->server->addFunction('echoAnyElement');
3434
}
3535

36-
function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
36+
function __doRequest($request, $location, $action, $version, $one_way = 0): string {
3737
ob_start();
3838
$this->server->handle($request);
3939
$response = ob_get_contents();

ext/soap/tests/bug69280.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class TestWS extends \SoapClient {
2525
);
2626
}
2727

28-
public function __doRequest(string $request, string $location, string $action, int $version, bool $oneWay = false): ?string {
28+
public function __doRequest(string $request, string $location, string $action, int $version, bool $oneWay = false): never {
2929
die($request);
3030
}
3131
}

ext/soap/tests/bugs/bug28969.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class LocalSoapClient extends SoapClient {
1818
$this->server->addFunction('test');
1919
}
2020

21-
function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
21+
function __doRequest($request, $location, $action, $version, $one_way = 0): string {
2222
ob_start();
2323
$this->server->handle($request);
2424
$response = ob_get_contents();

ext/soap/tests/bugs/bug29795.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class LocalSoapClient extends SoapClient {
1212
parent::__construct($wsdl, $options);
1313
}
1414

15-
function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
15+
function __doRequest($request, $location, $action, $version, $one_way = 0): string {
1616
return <<<EOF
1717
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
1818
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"

ext/soap/tests/bugs/bug29839.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class LocalSoapClient extends SoapClient {
2020
$this->server->addFunction('EchoString');
2121
}
2222

23-
function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
23+
function __doRequest($request, $location, $action, $version, $one_way = 0): string {
2424
ob_start();
2525
$this->server->handle($request);
2626
$response = ob_get_contents();

ext/soap/tests/bugs/bug29844.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class LocalSoapClient extends SoapClient {
2222
$this->server->setClass('hello_world');
2323
}
2424

25-
function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
25+
function __doRequest($request, $location, $action, $version, $one_way = 0): string {
2626
ob_start();
2727
$this->server->handle($request);
2828
$response = ob_get_contents();

ext/soap/tests/bugs/bug30045.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class LocalSoapClient extends SoapClient {
2121
$this->server->addFunction('foo');
2222
}
2323

24-
function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
24+
function __doRequest($request, $location, $action, $version, $one_way = 0): string {
2525
$xml = simplexml_load_string($request);
2626
echo $xml->children("http://schemas.xmlsoap.org/soap/envelope/")->Body->children("http://test-uri")->children()->param1->asXML(),"\n";
2727
unset($xml);

ext/soap/tests/bugs/bug30106.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class LocalSoapClient extends SoapClient {
2121
$this->server->addFunction("getContinentList");
2222
}
2323

24-
function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
24+
function __doRequest($request, $location, $action, $version, $one_way = 0): string {
2525
echo $request;
2626
ob_start();
2727
$this->server->handle($request);

ext/soap/tests/bugs/bug30175.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ soap.wsdl_cache_enabled=0
99

1010
class LocalSoapClient extends SoapClient {
1111

12-
function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
12+
function __doRequest($request, $location, $action, $version, $one_way = 0): string {
1313
return <<<EOF
1414
<?xml version="1.0" encoding="UTF-8"?>
1515
<SOAP-ENV:Envelope

ext/soap/tests/bugs/bug30928.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class LocalSoapClient extends SoapClient {
2525
$this->server->addFunction('test');
2626
}
2727

28-
function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
28+
function __doRequest($request, $location, $action, $version, $one_way = 0): string {
2929
ob_start();
3030
$this->server->handle($request);
3131
$response = ob_get_contents();

0 commit comments

Comments
 (0)