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