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