1
0
mirror of https://github.com/php/php-src.git synced 2026-03-29 19:52:20 +02:00
Files
archived-php-src/ext/soap/tests/classmap005.phpt
Gina Peter Banyard e1b59e9edd 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.
2024-06-19 02:23:08 +01:00

51 lines
1.4 KiB
PHP

--TEST--
SOAP Classmap 5: SoapClient support for classmap with namespace
--EXTENSIONS--
soap
--INI--
soap.wsdl_cache_enabled=0
--FILE--
<?php
class TestSoapClient extends SoapClient{
function __doRequest($request, $location, $action, $version, $one_way = 0): string {
return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.nothing.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body>
<ns1:dotest2Response><res xsi:type="ns1:book">
<a xsi:type="xsd:string">Blaat</a>
<b xsi:type="xsd:string">aap</b>
</res>
</ns1:dotest2Response></SOAP-ENV:Body></SOAP-ENV:Envelope>
EOF;
}
}
class bookNs {
public $a="a";
public $b="c";
}
class book {
public $a="a";
public $b="c";
}
$options=Array(
'actor' =>'http://schema.nothing.com',
'classmap' => array('book'=>'book', '{http://schemas.nothing.com}book'=>'bookNs')
);
$client = new TestSoapClient(__DIR__."/classmap.wsdl",$options);
$ret = $client->dotest2("???");
var_dump($ret);
echo "ok\n";
?>
--EXPECTF--
object(bookNs)#%d (%d) {
["a"]=>
string(5) "Blaat"
["b"]=>
string(3) "aap"
}
ok