1--TEST--
2Request #47317 (SoapServer::__getLastResponse)
3--EXTENSIONS--
4soap
5--INI--
6soap.wsdl_cache_enabled=0
7--FILE--
8<?php
9function f() {
10}
11
12class LocalSoapClient extends SoapClient {
13  public $server;
14
15  function __construct($wsdl, $options) {
16    parent::__construct($wsdl, $options);
17    $this->server = new SoapServer($wsdl, $options);
18    $this->server->addFunction("f");
19  }
20
21  function __doRequest($request, $location, $action, $version, $one_way = 0): string {
22    ob_start();
23    $this->server->handle($request);
24    $response = ob_get_contents();
25    ob_end_clean();
26    return $response;
27  }
28}
29
30$client = new LocalSoapClient(__DIR__."/../classmap003.wsdl", ["trace" => false]);
31$client->f();
32var_dump($client->__getLastResponse());
33var_dump($client->server->__getLastResponse());
34var_dump($client->__getLastResponse() === $client->server->__getLastResponse());
35
36echo "---\n";
37
38$client = new LocalSoapClient(__DIR__."/../classmap003.wsdl", ["trace" => true]);
39var_dump($client->__getLastResponse());
40var_dump($client->server->__getLastResponse());
41var_dump($client->__getLastResponse() === $client->server->__getLastResponse());
42
43echo "---\n";
44
45$client->f();
46echo $client->__getLastResponse(), "\n";
47echo $client->server->__getLastResponse(), "\n";
48var_dump($client->__getLastResponse() === $client->server->__getLastResponse());
49?>
50--EXPECT--
51NULL
52NULL
53bool(true)
54---
55NULL
56NULL
57bool(true)
58---
59<?xml version="1.0" encoding="UTF-8"?>
60<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:ab" 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/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:fResponse><fReturn xsi:nil="true" xsi:type="ns1:A"/></ns1:fResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
61
62<?xml version="1.0" encoding="UTF-8"?>
63<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:ab" 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/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:fResponse><fReturn xsi:nil="true" xsi:type="ns1:A"/></ns1:fResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
64
65bool(true)
66