bug43045.phpt 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --TEST--
  2. Bug #43045i (SOAP encoding violation on "INF" for type double/float)
  3. --EXTENSIONS--
  4. soap
  5. --FILE--
  6. <?php
  7. function test($x) {
  8. return $x;
  9. }
  10. class TestSoapClient extends SoapClient {
  11. function __construct($wsdl, $options) {
  12. parent::__construct($wsdl, $options);
  13. $this->server = new SoapServer($wsdl, $options);
  14. $this->server->addFunction('test');
  15. }
  16. function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
  17. ob_start();
  18. $this->server->handle($request);
  19. $response = ob_get_contents();
  20. ob_end_clean();
  21. return $response;
  22. echo $request;
  23. return '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  24. xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
  25. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  26. soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  27. xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  28. <soap:Body><testResponse xmlns="urn:TestSOAP">
  29. <s-gensym3>
  30. <doubleInfinity xsi:type="xsd:double">INF</doubleInfinity>
  31. </s-gensym3>
  32. </testResponse>
  33. </soap:Body></soap:Envelope>';
  34. }
  35. }
  36. $client = new TestSoapClient(NULL, array(
  37. "location" => "test://",
  38. "uri" => 'urn:TestSOAP',
  39. "style" => SOAP_RPC,
  40. "use" => SOAP_ENCODED
  41. ));
  42. var_dump($client->test(0.1));
  43. var_dump($client->test(NAN));
  44. var_dump($response = $client->test(INF));
  45. var_dump($response = $client->test(-INF));
  46. ?>
  47. --EXPECT--
  48. float(0.1)
  49. float(NAN)
  50. float(INF)
  51. float(-INF)