xref: /PHP-8.4/ext/soap/tests/bugs/bug28969.phpt (revision e1b59e9e)
1--TEST--
2Bug #28969 (Wrong data encoding of special characters)
3--EXTENSIONS--
4soap
5--FILE--
6<?php
7function test() {
8  return "��";
9//  return utf8_encode("��");
10}
11
12class LocalSoapClient extends SoapClient {
13  private $server;
14
15  function __construct($wsdl, $options) {
16    parent::__construct($wsdl, $options);
17    $this->server = new SoapServer($wsdl, $options);
18    $this->server->addFunction('test');
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
31$x = new LocalSoapClient(NULL,array('location'=>'test://',
32                                    'uri'=>'http://testuri.org',
33                                    'encoding'=>'ISO-8859-1'));
34var_dump($x->test());
35echo "ok\n";
36?>
37--EXPECT--
38string(3) "��"
39ok
40