xref: /PHP-8.4/ext/soap/tests/bugs/bug38067.phpt (revision e1b59e9e)
1--TEST--
2Bug #38067 (Parameters are not decoded from utf-8 when using encoding option)
3--EXTENSIONS--
4soap
5--INI--
6soap.wsdl_cache_enabled=0
7--FILE--
8<?php
9function Test($param) {
10    global $g;
11    $g = $param->str;
12    return $g;
13}
14
15class TestSoapClient extends SoapClient {
16  private $server;
17
18  function __construct($wsdl, $opt) {
19    parent::__construct($wsdl, $opt);
20    $this->server = new SoapServer($wsdl, $opt);
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__.'/bug38067.wsdl',
34    array('encoding' => 'ISO-8859-1'));
35$str = 'test: �';
36$res = $client->Test(array('str'=>$str));
37echo $str."\n";
38echo $res."\n";
39echo $g."\n";
40?>
41--EXPECT--
42test: �
43test: �
44test: �
45