bug36575.phpt 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. --TEST--
  2. Bug #36575 (Incorrect complex type instantiation with hierarchies)
  3. --EXTENSIONS--
  4. soap
  5. --INI--
  6. soap.wsdl_cache_enabled=0
  7. --FILE--
  8. <?php
  9. abstract class CT_A1 {
  10. public $var1;
  11. }
  12. class CT_A2 extends CT_A1 {
  13. public $var2;
  14. }
  15. class CT_A3 extends CT_A2 {
  16. public $var3;
  17. }
  18. // returns A2 in WSDL
  19. function test( $a1 ) {
  20. $a3 = new CT_A3();
  21. $a3->var1 = $a1->var1;
  22. $a3->var2 = "var two";
  23. $a3->var3 = "var three";
  24. return $a3;
  25. }
  26. $classMap = array("A1" => "CT_A1", "A2" => "CT_A2", "A3" => "CT_A3");
  27. $client = new SoapClient(__DIR__."/bug36575.wsdl", array("trace" => 1, "exceptions" => 0, "classmap" => $classMap));
  28. $a2 = new CT_A2();
  29. $a2->var1 = "one";
  30. $a2->var2 = "two";
  31. $client->test($a2);
  32. $soapRequest = $client->__getLastRequest();
  33. echo $soapRequest;
  34. $server = new SoapServer(__DIR__."/bug36575.wsdl", array("classmap" => $classMap));
  35. $server->addFunction("test");
  36. $server->handle($soapRequest);
  37. echo "ok\n";
  38. ?>
  39. --EXPECT--
  40. <?xml version="1.0" encoding="UTF-8"?>
  41. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:test.soap#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="urn:test.soap.types#" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:test><a1 xsi:type="ns2:A2"><var1 xsi:type="xsd:string">one</var1><var2 xsi:type="xsd:string">two</var2></a1></ns1:test></SOAP-ENV:Body></SOAP-ENV:Envelope>
  42. <?xml version="1.0" encoding="UTF-8"?>
  43. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:test.soap#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="urn:test.soap.types#" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:testResponse><result xsi:type="ns2:A3"><var1 xsi:type="xsd:string">one</var1><var2 xsi:type="xsd:string">var two</var2><var3 xsi:type="xsd:string">var three</var3></result></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
  44. ok