xref: /PHP-8.1/ext/soap/tests/bugs/bug39121.phpt (revision 8ae4b560)
1--TEST--
2Bug #39121 (Incorrect return array handling in non-wsdl soap client)
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:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
14        <soap:Body>
15                <getDIDAreaResponse xmlns="http://didx.org/GetList">
16                        <soapenc:Array soapenc:arrayType="xsd:string[2]" xsi:type="soapenc:Array">
17                                <item xsi:type="xsd:string">StateCode</item>
18                                <item xsi:type="xsd:string">description</item>
19                        </soapenc:Array>
20                        <soapenc:Array soapenc:arrayType="xsd:anyType[2]" xsi:type="soapenc:Array">
21                                <item xsi:type="xsd:int">241</item>
22                                <item xsi:type="xsd:string">Carabobo</item>
23                        </soapenc:Array>
24                        <soapenc:Array soapenc:arrayType="xsd:anyType[2]" xsi:type="soapenc:Array">
25                                <item xsi:type="xsd:int">243</item>
26                                <item xsi:type="xsd:string">Aragua and Carabobo</item>
27                        </soapenc:Array>
28                        <soapenc:Array soapenc:arrayType="xsd:anyType[2]" xsi:type="soapenc:Array">
29                                <item xsi:type="xsd:int">261</item>
30                                <item xsi:type="xsd:string">Zulia</item>
31                        </soapenc:Array>
32                </getDIDAreaResponse>
33        </soap:Body>
34</soap:Envelope>
35EOF;
36  }
37}
38
39$client = new LocalSoapClient(NULL, array('location'=>'test://','uri'=>'test://'));
40print_r($client->getDIDAreaResponse());
41?>
42--EXPECT--
43Array
44(
45    [Array] => Array
46        (
47            [0] => Array
48                (
49                    [0] => StateCode
50                    [1] => description
51                )
52
53            [1] => Array
54                (
55                    [0] => 241
56                    [1] => Carabobo
57                )
58
59            [2] => Array
60                (
61                    [0] => 243
62                    [1] => Aragua and Carabobo
63                )
64
65            [3] => Array
66                (
67                    [0] => 261
68                    [1] => Zulia
69                )
70
71        )
72
73)
74