bug38004.phpt 919 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. Bug #38004 (Parameters in SoapServer are decoded twice)
  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->strA."\n".$param->strB."\n";
  12. return $g;
  13. }
  14. class TestSoapClient extends SoapClient {
  15. function __construct($wsdl) {
  16. parent::__construct($wsdl);
  17. $this->server = new SoapServer($wsdl);
  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__.'/bug38004.wsdl');
  29. $strA = 'test &amp; test';
  30. $strB = 'test & test';
  31. $res = $client->Test(array('strA'=>$strA, 'strB'=>$strB));
  32. print_r($res);
  33. print_r($g);
  34. ?>
  35. --EXPECT--
  36. test &amp; test
  37. test & test
  38. test &amp; test
  39. test & test