|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43045 SOAP encoding violation on "INF" for type double/float
Submitted: 2007-10-19 21:04 UTC Modified: 2008-10-01 11:06 UTC
Avg. Score:4.8 ± 0.4
Reproduced:5 of 5 (100.0%)
Same Version:4 (80.0%)
Same OS:3 (60.0%)
From: nick at attask dot com Assigned: dmitry (profile)
Status: Closed Package: SOAP related
PHP Version: 5.2.6 OS: *
Private report: No CVE-ID: None
 [2007-10-19 21:04 UTC] nick at attask dot com
Bug 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:


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:
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());
	catch (SoapFault $e) {
} else {
	header('Content-Type: text/xml; charset=utf-8');
	?><soap:Envelope xmlns:xsi="" xmlns:soapenc="" xmlns:xsd="" soap:encodingStyle="" xmlns:soap=""><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:

Actual result:
SoapFault Object
    [message:protected] => SOAP-ERROR: Encoding: Violation of encoding rules
    [faultstring] => SOAP-ERROR: Encoding: Violation of encoding rules
    [faultcode] => Client
    [faultcodens] =>


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-30 19:00 UTC]
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..
 [2008-09-30 19:22 UTC]
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:45 UTC]
workaround: get local copy of the wsdl file and change all double types to string. :)
 [2008-10-01 08:43 UTC]
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
Thank you for the report, and for helping us make PHP better.

 [2008-10-01 11:06 UTC]
Tested latest CVS of PHP_5_2 and it works now. Thanks Dmitry!
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 26 13:01:32 2024 UTC