xref: /PHP-8.3/ext/soap/tests/bug79536.phpt (revision 7f2f0c00)
1--TEST--
2Bug #79536 (zend_clear_exception prevent exception's destructor to be called)
3--EXTENSIONS--
4soap
5--INI--
6soap.wsdl_cache_enabled=0
7--FILE--
8<?php
9$GLOBALS['HTTP_RAW_POST_DATA']="
10<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
11    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
12    xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
13    xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
14    xmlns:ns1=\"http://schemas.nothing.com\"
15>
16  <env:Body>
17<ns1:dotest2>
18<dotest2 xsi:type=\"xsd:string\">???</dotest2>
19</ns1:dotest2>
20 </env:Body>
21<env:Header/>
22</env:Envelope>";
23
24class myFault extends SoapFault {
25    public function __destruct() {
26    }
27}
28
29function book_to_xml($book) {
30    throw new myFault("Server", "Conversion Fault");
31}
32
33class test{
34    function dotest2($str){
35        $book = new book;
36        $book->a = "foo";
37        $book->b = "bar";
38        return $book;
39    }
40}
41
42class book{
43    public $a="a";
44    public $b="c";
45
46}
47
48$options=Array(
49        'actor'   =>'http://schemas.nothing.com',
50        'typemap' => array(array("type_ns"   => "http://schemas.nothing.com",
51                                 "type_name" => "book",
52                                 "to_xml"    => "book_to_xml"))
53        );
54
55$server = new SoapServer(__DIR__."/classmap.wsdl",$options);
56$server->setClass("test");
57$server->handle($HTTP_RAW_POST_DATA);
58echo "ok\n";
59?>
60--EXPECT--
61<?xml version="1.0" encoding="UTF-8"?>
62<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Conversion Fault</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
63ok
64