bug36629.phpt 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --TEST--
  2. Bug #36629 (SoapServer::handle() exits on SOAP faults)
  3. --EXTENSIONS--
  4. soap
  5. --FILE--
  6. <?php
  7. function test1() {
  8. throw new SoapFault("Server", "test1");
  9. }
  10. function test2() {
  11. return new SoapFault("Server", "test2");
  12. }
  13. $server = new soapserver(null,array('uri'=>"http://testuri.org"));
  14. $server->addfunction(array("test1","test2"));
  15. $HTTP_RAW_POST_DATA = <<<EOF
  16. <?xml version="1.0" encoding="ISO-8859-1"?>
  17. <SOAP-ENV:Envelope
  18. SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  19. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  20. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  21. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  22. xmlns:si="http://soapinterop.org/xsd">
  23. <SOAP-ENV:Body>
  24. <ns1:test1 xmlns:ns1="http://testuri.org" />
  25. </SOAP-ENV:Body>
  26. </SOAP-ENV:Envelope>
  27. EOF;
  28. $server->handle($HTTP_RAW_POST_DATA);
  29. $HTTP_RAW_POST_DATA = <<<EOF
  30. <?xml version="1.0" encoding="ISO-8859-1"?>
  31. <SOAP-ENV:Envelope
  32. SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  33. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  34. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  35. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  36. xmlns:si="http://soapinterop.org/xsd">
  37. <SOAP-ENV:Body>
  38. <ns1:test2 xmlns:ns1="http://testuri.org" />
  39. </SOAP-ENV:Body>
  40. </SOAP-ENV:Envelope>
  41. EOF;
  42. $server->handle($HTTP_RAW_POST_DATA);
  43. echo "ok\n";
  44. ?>
  45. --EXPECT--
  46. <?xml version="1.0" encoding="UTF-8"?>
  47. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>test1</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
  48. <?xml version="1.0" encoding="UTF-8"?>
  49. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>test2</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
  50. ok