xref: /PHP-8.4/ext/soap/tests/bugs/bug73237.phpt (revision e1b59e9e)
1--TEST--
2Bug #73237 "Any" data missing when result includes a struct
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"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:test.example.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sf="urn:object.test.example.org"><soapenv:Body><queryResponse><result xsi:type="QueryResult"><done>true</done><queryLocator xsi:nil="true"/><records xsi:type="sf:genericObject"><sf:type>CampaignMember</sf:type><sf:Id>00vi0000011VMgeAAG</sf:Id><sf:Id>00vi0000011VMgeAAG</sf:Id><sf:CampaignId>701i0000001lreeAAA</sf:CampaignId><sf:Status>Sent</sf:Status><sf:ContactId xsi:nil="true"/><sf:LeadId>00Qi000001UrbYFEAZ</sf:LeadId><sf:Contact xsi:nil="true"/><sf:Lead xsi:type="sf:genericObject"><sf:type>Lead</sf:type><sf:Id xsi:nil="true"/><sf:Email>angela.lansbury@cbs.com</sf:Email></sf:Lead></records><size>1</size></result></queryResponse></soapenv:Body></soapenv:Envelope>
13EOF;
14  }
15}
16$client = new LocalSoapClient(__DIR__."/bug73237.wsdl");
17var_dump($client->query(""));
18?>
19--EXPECTF--
20object(stdClass)#%d (%d) {
21  ["result"]=>
22  object(stdClass)#%d (%d) {
23    ["done"]=>
24    string(4) "true"
25    ["queryLocator"]=>
26    NULL
27    ["records"]=>
28    object(SoapVar)#%d (%d) {
29      ["enc_type"]=>
30      int(0)
31      ["enc_value"]=>
32      object(stdClass)#%d (%d) {
33        ["type"]=>
34        string(14) "CampaignMember"
35        ["Id"]=>
36        array(2) {
37          [0]=>
38          string(18) "00vi0000011VMgeAAG"
39          [1]=>
40          string(18) "00vi0000011VMgeAAG"
41        }
42        ["any"]=>
43        array(2) {
44          [0]=>
45          string(175) "<sf:CampaignId>701i0000001lreeAAA</sf:CampaignId><sf:Status>Sent</sf:Status><sf:ContactId xsi:nil="true"/><sf:LeadId>00Qi000001UrbYFEAZ</sf:LeadId><sf:Contact xsi:nil="true"/>"
46          ["Lead"]=>
47          object(stdClass)#%d (%d) {
48            ["type"]=>
49            string(4) "Lead"
50            ["Id"]=>
51            NULL
52            ["any"]=>
53            string(44) "<sf:Email>angela.lansbury@cbs.com</sf:Email>"
54          }
55        }
56      }
57      ["enc_stype"]=>
58      string(13) "genericObject"
59      ["enc_ns"]=>
60      string(27) "urn:object.test.example.org"
61      ["enc_name"]=>
62      NULL
63      ["enc_namens"]=>
64      NULL
65    }
66    ["size"]=>
67    string(1) "1"
68  }
69}
70