bug30928.phpt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. --TEST--
  2. Bug #30928 (When Using WSDL, SoapServer doesn't handle private or protected properties)
  3. --EXTENSIONS--
  4. soap
  5. --FILE--
  6. <?php
  7. ini_set("soap.wsdl_cache_enabled", 0);
  8. class foo {
  9. public $a="a";
  10. private $b="b";
  11. protected $c="c";
  12. }
  13. function test($x) {
  14. return $x;
  15. }
  16. class LocalSoapClient extends SoapClient {
  17. function __construct($wsdl, $options) {
  18. parent::__construct($wsdl, $options);
  19. $this->server = new SoapServer($wsdl, $options);
  20. $this->server->addFunction('test');
  21. }
  22. function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
  23. ob_start();
  24. $this->server->handle($request);
  25. $response = ob_get_contents();
  26. ob_end_clean();
  27. return $response;
  28. }
  29. }
  30. $x = new LocalSoapClient(__DIR__."/bug30928.wsdl",
  31. array());
  32. var_dump($x->test(new foo()));
  33. $x = new LocalSoapClient(__DIR__."/bug30928.wsdl",
  34. array("classmap" => array('testType'=>'foo')));
  35. var_dump($x->test(new foo()));
  36. echo "ok\n";
  37. ?>
  38. --EXPECTF--
  39. object(stdClass)#%d (3) {
  40. ["a"]=>
  41. string(1) "a"
  42. ["b"]=>
  43. string(1) "b"
  44. ["c"]=>
  45. string(1) "c"
  46. }
  47. object(foo)#%d (3) {
  48. ["a"]=>
  49. string(1) "a"
  50. ["b":"foo":private]=>
  51. string(1) "b"
  52. ["c":protected]=>
  53. string(1) "c"
  54. }
  55. ok