xref: /PHP-8.3/ext/soap/tests/bugs/bug32941.phpt (revision 8ae4b560)
1--TEST--
2Bug #32941 (Sending structured exception kills a php)
3--EXTENSIONS--
4soap
5--FILE--
6<?php
7class TestSoapClient extends SoapClient {
8  function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
9    return <<<EOF
10<?xml version="1.0" encoding="UTF-8"?>
11<soapenv:Envelope
12xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
13xmlns:xsd="http://www.w3.org/2001/XMLSchema"
14xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
15    <soapenv:Body>
16        <soapenv:Fault>
17            <faultcode>soapenv:Server.userException</faultcode>
18            <faultstring>service.EchoServiceException</faultstring>
19            <detail>
20                <service.EchoServiceException xsi:type="ns1:EchoServiceException" xmlns:ns1="urn:service.EchoService">
21                    <intParameter xsi:type="xsd:int">105</intParameter>
22                    <parameter xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">string param</parameter>
23                </service.EchoServiceException>
24                <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">steckovic</ns2:hostname>
25            </detail>
26        </soapenv:Fault>
27    </soapenv:Body>
28</soapenv:Envelope>
29EOF;
30    }
31}
32
33ini_set("soap.wsdl_cache_enabled", 1);
34$client = new TestSoapClient(__DIR__.'/bug32941.wsdl', array("trace" => 1, 'exceptions' => 0));
35$ahoj = $client->echoString('exception');
36$client = new TestSoapClient(__DIR__.'/bug32941.wsdl', array("trace" => 1, 'exceptions' => 0));
37$ahoj = $client->echoString('exception');
38echo "ok\n";
39?>
40--EXPECT--
41ok
42