xref: /php-src/ext/soap/tests/bugs/bug29844.phpt (revision 8b561d33)
1--TEST--
2Bug #29844 (SOAP doesn't return the result of a valid SOAP request)
3--EXTENSIONS--
4soap
5--INI--
6soap.wsdl_cache_enabled=0
7--FILE--
8<?php
9
10class hello_world {
11  public function hello($to) {
12    return 'Hello ' . $to;
13  }
14}
15
16class LocalSoapClient extends SoapClient {
17  private $server;
18
19  function __construct($wsdl, $options) {
20    parent::__construct($wsdl, $options);
21    $this->server = new SoapServer($wsdl, $options);
22    $this->server->setClass('hello_world');
23  }
24
25  function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
26    ob_start();
27    $this->server->handle($request);
28    $response = ob_get_contents();
29    ob_end_clean();
30    return $response;
31  }
32
33}
34
35$client = new LocalSoapClient(__DIR__."/bug29844.wsdl", array("trace"=>1));
36var_dump($client->hello('davey'));
37?>
38--EXPECT--
39string(11) "Hello davey"
40