bug37013.phpt 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --TEST--
  2. Bug #37013 (server hangs when returning circular object references)
  3. --EXTENSIONS--
  4. soap
  5. --INI--
  6. soap.wsdl_cache_enabled=0
  7. --FILE--
  8. <?php
  9. $request = <<<REQUEST
  10. <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
  11. xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  12. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  13. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  14. <soapenv:Body>
  15. <ns2:getThingWithParent
  16. soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  17. xmlns:ns2="urn:test.soapserver#"/>
  18. </soapenv:Body>
  19. </soapenv:Envelope>
  20. REQUEST;
  21. class ThingWithParent
  22. {
  23. var $parent;
  24. var $id;
  25. var $children;
  26. function __construct( $id, $parent ) {
  27. $this->id = $id;
  28. $this->parent = $parent;
  29. }
  30. }
  31. class MultiRefTest {
  32. public function getThingWithParent() {
  33. $p = new ThingWithParent( 1, null );
  34. $p2 = new ThingWithParent( 2, $p );
  35. $p3 = new ThingWithParent( 3, $p );
  36. $p->children = array( $p2, $p3 );
  37. return $p2;
  38. }
  39. }
  40. $server = new SoapServer(__DIR__."/bug37013.wsdl");
  41. $server->setClass( "MultiRefTest");
  42. $server->handle( $request );
  43. ?>
  44. --EXPECT--
  45. <?xml version="1.0" encoding="UTF-8"?>
  46. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:test.soapserver#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:getThingWithParentResponse><result id="ref1" xsi:type="SOAP-ENC:Struct"><parent id="ref2" xsi:type="SOAP-ENC:Struct"><parent xsi:nil="true"/><id xsi:type="xsd:int">1</id><children SOAP-ENC:arrayType="SOAP-ENC:Struct[2]" xsi:type="SOAP-ENC:Array"><item href="#ref1"/><item xsi:type="SOAP-ENC:Struct"><parent href="#ref2"/><id xsi:type="xsd:int">3</id><children xsi:nil="true"/></item></children></parent><id xsi:type="xsd:int">2</id><children xsi:nil="true"/></result></ns1:getThingWithParentResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>