xref: /PHP-8.3/ext/soap/tests/bugs/bug38004.phpt (revision 8b561d33)
1--TEST--
2Bug #38004 (Parameters in SoapServer are decoded twice)
3--EXTENSIONS--
4soap
5--INI--
6soap.wsdl_cache_enabled=0
7--FILE--
8<?php
9function Test($param) {
10    global $g;
11    $g = $param->strA."\n".$param->strB."\n";
12    return $g;
13}
14
15class TestSoapClient extends SoapClient {
16  private $server;
17
18  function __construct($wsdl) {
19    parent::__construct($wsdl);
20    $this->server = new SoapServer($wsdl);
21    $this->server->addFunction('Test');
22  }
23
24  function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
25    ob_start();
26    $this->server->handle($request);
27    $response = ob_get_contents();
28    ob_end_clean();
29    return $response;
30  }
31}
32
33$client = new TestSoapClient(__DIR__.'/bug38004.wsdl');
34$strA = 'test &amp; test';
35$strB = 'test & test';
36$res = $client->Test(array('strA'=>$strA, 'strB'=>$strB));
37print_r($res);
38print_r($g);
39?>
40--EXPECT--
41test &amp; test
42test & test
43test &amp; test
44test & test
45