bug31695.phpt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. --TEST--
  2. Bug #31695 (Cannot redefine endpoint when using WSDL)
  3. --EXTENSIONS--
  4. soap
  5. --FILE--
  6. <?php
  7. ini_set("soap.wsdl_cache_enabled", 0);
  8. function Test($x) {
  9. return $x;
  10. }
  11. class LocalSoapClient extends SoapClient {
  12. function __construct($wsdl, $options=array()) {
  13. parent::__construct($wsdl, $options);
  14. $this->server = new SoapServer($wsdl, $options);
  15. $this->server->addFunction("Test");
  16. }
  17. function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
  18. echo "$location\n";
  19. ob_start();
  20. $this->server->handle($request);
  21. $response = ob_get_contents();
  22. ob_end_clean();
  23. return $response;
  24. }
  25. }
  26. $client = new LocalSoapClient(__DIR__."/bug31695.wsdl");
  27. $client->Test("str");
  28. $client = new LocalSoapClient(__DIR__."/bug31695.wsdl", array("location"=>"test://1"));
  29. $client->Test("str");
  30. $client->__soapCall("Test",
  31. array("arg1"),
  32. array("location"=>"test://2"));
  33. $old = $client->__setLocation("test://3");
  34. echo "$old\n";
  35. $client->Test("str");
  36. $client->Test("str");
  37. $client->__setLocation($old);
  38. $client->Test("str");
  39. $old = $client->__setLocation();
  40. $client->Test("str");
  41. $client->__setLocation($old);
  42. $client->Test("str");
  43. $client->__setLocation(null);
  44. $client->Test("str");
  45. var_dump($client->__setLocation());
  46. ?>
  47. --EXPECT--
  48. test://0
  49. test://1
  50. test://2
  51. test://1
  52. test://3
  53. test://3
  54. test://1
  55. test://0
  56. test://1
  57. test://0
  58. NULL