xref: /php-src/ext/soap/tests/bugs/bug38536.phpt (revision e1b59e9e)
1--TEST--
2Bug #38536 (SOAP returns an array of values instead of an object)
3--EXTENSIONS--
4soap
5--INI--
6soap.wsdl_cache_enabled=0
7--FILE--
8<?php
9class LocalSoapClient extends SoapClient {
10  function __doRequest($request, $location, $action, $version, $one_way = 0): string {
11    return <<<EOF
12<?xml version="1.0" encoding="UTF-8"?>
13<SOAP-ENV:Envelope
14  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
15  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
16  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
17  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
18  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19  xmlns:ns1="http://www.grupos.com.br/ws/enturma/client">
20<SOAP-ENV:Body>
21<getClientInfoFromDomainResponse SOAP-ENC:root="1">
22  <xsd:Result xsi:type="ns1:ClientType">
23    <id xsi:type="xsd:int">2</id>
24    <address href="#i2"/>
25  </xsd:Result>
26</getClientInfoFromDomainResponse>
27<xsd:address id="i2" xsi:type="ns1:ClientAddressType" SOAP-ENC:root="0">
28  <idClient xsi:type="xsd:long">2</idClient>
29  <address href="#i3"/>
30</xsd:address>
31<address xsi:type="xsd:string" id="i3" SOAP-ENC:root="0">Test</address>
32</SOAP-ENV:Body>
33</SOAP-ENV:Envelope>
34EOF;
35  }
36}
37
38ini_set("soap.wsdl_cache_enabled", 0);
39$SOAPObject = new LocalSoapClient(__DIR__.'/bug38536.wsdl');
40print_r($SOAPObject->test());
41?>
42--EXPECT--
43stdClass Object
44(
45    [id] => 2
46    [address] => stdClass Object
47        (
48            [idClient] => 2
49            [address] => Test
50        )
51
52)
53