xref: /php-src/ext/soap/tests/bugs/bug71996.phpt (revision e1b59e9e)
1--TEST--
2Bug #71996: Using references in arrays doesn't work like expected
3--EXTENSIONS--
4soap
5--FILE--
6<?php
7
8$client = new class(null, ['location' => '', 'uri' => 'http://example.org']) extends SoapClient {
9    public function __doRequest($request, $location, $action, $version, $one_way = 0): string {
10        echo $request, "\n";
11        return '';
12    }
13};
14
15$ref = array("foo");
16$data = array(&$ref);
17$client->foo($data);
18
19$ref = array("def" => "foo");
20$data = array("abc" => &$ref);
21$client->foo($data);
22
23?>
24--EXPECT--
25<?xml version="1.0" encoding="UTF-8"?>
26<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://example.org" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:foo><param0 SOAP-ENC:arrayType="SOAP-ENC:Array[1]" xsi:type="SOAP-ENC:Array"><item SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array"><item xsi:type="xsd:string">foo</item></item></param0></ns1:foo></SOAP-ENV:Body></SOAP-ENV:Envelope>
27
28<?xml version="1.0" encoding="UTF-8"?>
29<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://example.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:foo><param0 xsi:type="ns2:Map"><item><key xsi:type="xsd:string">abc</key><value xsi:type="ns2:Map"><item><key xsi:type="xsd:string">def</key><value xsi:type="xsd:string">foo</value></item></value></item></param0></ns1:foo></SOAP-ENV:Body></SOAP-ENV:Envelope>
30