xref: /PHP-8.3/ext/soap/tests/bugs/bug55323.phpt (revision 8ae4b560)
1--TEST--
2Bug #55323 (SoapClient segmentation fault when XSD_TYPEKIND_EXTENSION contains itself)
3--EXTENSIONS--
4soap
5--FILE--
6<?php
7ini_set("soap.wsdl_cache_enabled",0);
8$timestamp = "2011-07-30T03:25:00-05:00";
9$wsdl = __DIR__."/bug55323.wsdl";
10
11class TestSoapClient extends SoapClient {
12
13  function __construct($wsdl, $options) {
14    parent::__construct($wsdl, $options);
15  }
16
17  function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
18    return <<<EOF
19<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test.com/soap/v3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
20   <SOAP-ENV:Body>
21      <ns1:getObjectResponse>
22         <getObjectReturn xsi:type="ns1:Customer" id="ref1">
23            <accountId xsi:type="xsd:int">1234</accountId>
24            <parent href="#ref1"/>
25         </getObjectReturn>
26      </ns1:getObjectResponse>
27   </SOAP-ENV:Body>
28</SOAP-ENV:Envelope>
29EOF;
30  }
31
32}
33
34$soapClient = new TestSoapClient($wsdl,
35        array('trace' => 1, 'exceptions' => 0));
36$result = $soapClient->getObject();
37var_dump($result);
38?>
39--EXPECTF--
40object(stdClass)#%d (2) {
41  ["accountId"]=>
42  int(1234)
43  ["parent"]=>
44  *RECURSION*
45}
46