bug38067.phpt 911 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. Bug #38067 (Parameters are not decoded from utf-8 when using encoding option)
  3. --EXTENSIONS--
  4. soap
  5. --INI--
  6. soap.wsdl_cache_enabled=0
  7. --FILE--
  8. <?php
  9. function Test($param) {
  10. global $g;
  11. $g = $param->str;
  12. return $g;
  13. }
  14. class TestSoapClient extends SoapClient {
  15. function __construct($wsdl, $opt) {
  16. parent::__construct($wsdl, $opt);
  17. $this->server = new SoapServer($wsdl, $opt);
  18. $this->server->addFunction('Test');
  19. }
  20. function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
  21. ob_start();
  22. $this->server->handle($request);
  23. $response = ob_get_contents();
  24. ob_end_clean();
  25. return $response;
  26. }
  27. }
  28. $client = new TestSoapClient(__DIR__.'/bug38067.wsdl',
  29. array('encoding' => 'ISO-8859-1'));
  30. $str = 'test: Ä';
  31. $res = $client->Test(array('str'=>$str));
  32. echo $str."\n";
  33. echo $res."\n";
  34. echo $g."\n";
  35. ?>
  36. --EXPECT--
  37. test: Ä
  38. test: Ä
  39. test: Ä