#43045 [Asn->Csd]: SOAP encoding violation on "INF" for type double/float
ID: 43045
Updated by: dmitry@php.net
Reported By: nick at attask dot com
-Status: Assigned
+Status: Closed
Bug Type: SOAP related
Operating System: *
PHP Version: 5.2.6
Assigned To: dmitry
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2008-09-30 19:45:06] jani@php.net
workaround: get local copy of the wsdl file and change all double types
to string. :)
------------------------------------------------------------------------
[2008-09-30 19:22:09] jani@php.net
Might be caused by the optimization patch for zend_operators.h
is_numeric_string() func which seems to nuke the inf/nan handling
totally out of the func..
------------------------------------------------------------------------
[2008-09-30 19:00:26] jani@php.net
I get the same problem here, sample code available via email if
requied. Basically: WSDL says data is double, return NaN / INF -> this
annoying error about "violation". Yet the same stuff works with other
languages..
------------------------------------------------------------------------
[2007-10-19 21:04:39] nick at attask dot com
Description:
------------
Bug 39815 (http://bugs.php.net/bug.php?id=39815) reported a
locale-sensitive error in decoding SOAP double values. The result was a
fix which it seems has broken support for special double values
represented by strings, such as:
INF
-INF
NAN
When a SOAP response sends one of these values (INF in the example
below) with type "double" or "float" in versions 5.2.1 and later, the
result is a SoapFault of "Violation of Encoding rules", when it should
successfully parse the result as a PHP float of value "INF".
This change happened in 5.2.1 in file ext/soap/php_encoding.c.
Versions 5.2.0 and older correctly produce the "Expected Result" below.
Reproduce code:
---------------
<?php
if (!$_REQUEST['soap-server']) {
try {
$client = new SoapClient(NULL, array(
"location" => $_SERVER['SCRIPT_URI'] . "?soap-server=1",
"uri" => 'urn:TestSOAP',
"style" => SOAP_RPC,
"use" => SOAP_ENCODED
));
$response = $client->__soapCall('test', array());
var_dump($response->doubleInfinity);
}
catch (SoapFault $e) {
print_r($e);
}
} else {
header('Content-Type: text/xml; charset=utf-8');
?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><testResponse
xmlns="urn:TestSOAP"><s-gensym3><doubleInfinity
xsi:type="xsd:double">INF</doubleInfinity></s-gensym3></testResponse></soap:Body></soap:Envelope><?php
}
?>
Expected result:
----------------
float(INF)
Actual result:
--------------
SoapFault Object
(
[message:protected] => SOAP-ERROR: Encoding: Violation of encoding
rules
...
[faultstring] => SOAP-ERROR: Encoding: Violation of encoding rules
[faultcode] => Client
[faultcodens] => http://schemas.xmlsoap.org/soap/envelope/
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43045&edit=1
Thread (7 messages)