xref: /php-src/ext/soap/tests/gh9720.phpt (revision e440e37f)
1--TEST--
2Bug GH-9720 (Null pointer dereference while serializing the response)
3--EXTENSIONS--
4soap
5--FILE--
6<?php
7error_reporting(E_ALL);
8ini_set('display_errors', 1);
9ini_set("soap.wsdl_cache_enabled", 0);
10
11class SoapService {
12    function openSession($user) {
13        return ["OK", "200"];
14    }
15}
16
17$server = new SoapServer(__DIR__ . '/gh9720.wsdl');
18$server->setClass(SoapService::class);
19$request = <<<XML
20<?xml version="1.0" encoding="UTF-8"?>
21<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:soapService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
22    <SOAP-ENV:Body>
23        <ns1:openSession>
24            <user xsi:type="xsd:string">istoph</user>
25        </ns1:openSession>
26    </SOAP-ENV:Body>
27</SOAP-ENV:Envelope>
28XML;
29
30$server->handle($request);
31?>
32--EXPECT--
33<?xml version="1.0" encoding="UTF-8"?>
34<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:soapService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:openSessionResponse><status xsi:type="xsd:string">OK</status><error_code xsi:type="xsd:string">200</error_code></ns1:openSessionResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
35