bug30106.phpt 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. --TEST--
  2. Bug #30106 (SOAP cannot not parse 'ref' element. Causes Uncaught SoapFault exception)
  3. --EXTENSIONS--
  4. soap
  5. --FILE--
  6. <?php
  7. ini_set("soap.wsdl_cache_enabled", 0);
  8. function getContinentList() {
  9. return array("getContinentListResult"=>array(
  10. "schema"=>"<xsd:schema><element name=\"test\" type=\"xsd:string\"/></xsd:schema>",
  11. "any"=>"<test>Hello World!</test><test>Bye World!</test>"));
  12. }
  13. class LocalSoapClient extends SoapClient {
  14. function __construct($wsdl, $options=array()) {
  15. parent::__construct($wsdl, $options);
  16. $this->server = new SoapServer($wsdl, $options);
  17. $this->server->addFunction("getContinentList");
  18. }
  19. function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
  20. echo $request;
  21. ob_start();
  22. $this->server->handle($request);
  23. $response = ob_get_contents();
  24. ob_end_clean();
  25. echo $response;
  26. return $response;
  27. }
  28. }
  29. $client = new LocalSoapClient(__DIR__."/bug30106.wsdl");
  30. var_dump($client->__getFunctions());
  31. var_dump($client->__getTypes());
  32. $x = $client->getContinentList(array("AFFILIATE_ID"=>1,"PASSWORD"=>"x"));
  33. var_dump($x);
  34. ?>
  35. --EXPECTF--
  36. array(1) {
  37. [0]=>
  38. string(71) "getContinentListResponse getContinentList(getContinentList $parameters)"
  39. }
  40. array(3) {
  41. [0]=>
  42. string(64) "struct getContinentList {
  43. int AFFILIATE_ID;
  44. string PASSWORD;
  45. }"
  46. [1]=>
  47. string(83) "struct getContinentListResponse {
  48. getContinentListResult getContinentListResult;
  49. }"
  50. [2]=>
  51. string(66) "struct getContinentListResult {
  52. <anyXML> schema;
  53. <anyXML> any;
  54. }"
  55. }
  56. <?xml version="1.0" encoding="UTF-8"?>
  57. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/PRWebServ/getOtherInformation"><SOAP-ENV:Body><ns1:getContinentList><ns1:AFFILIATE_ID>1</ns1:AFFILIATE_ID><ns1:PASSWORD>x</ns1:PASSWORD></ns1:getContinentList></SOAP-ENV:Body></SOAP-ENV:Envelope>
  58. <?xml version="1.0" encoding="UTF-8"?>
  59. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://tempuri.org/PRWebServ/getOtherInformation"><SOAP-ENV:Body><ns1:getContinentListResponse><ns1:getContinentListResult><xsd:schema><element name="test" type="xsd:string"/></xsd:schema><test>Hello World!</test><test>Bye World!</test></ns1:getContinentListResult></ns1:getContinentListResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
  60. object(stdClass)#%d (1) {
  61. ["getContinentListResult"]=>
  62. object(stdClass)#%d (2) {
  63. ["schema"]=>
  64. string(65) "<xsd:schema><element name="test" type="xsd:string"/></xsd:schema>"
  65. ["any"]=>
  66. string(48) "<test>Hello World!</test><test>Bye World!</test>"
  67. }
  68. }