#43045 [NEW]: SOAP encoding violation on "INF" for type double/float

From: Date: Fri, 19 Oct 2007 21:04:39 +0000
Subject: #43045 [NEW]: SOAP encoding violation on "INF" for type double/float
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-118735@lists.php.net to get a copy of this message
From:             nick at attask dot com
Operating system: Irrelevant
PHP version:      5.2.4
PHP Bug Type:     SOAP related
Bug description:  SOAP encoding violation on "INF" for type double/float

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 bug report at http://bugs.php.net/?id=43045&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43045&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43045&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43045&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43045&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43045&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=43045&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43045&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43045&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43045&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43045&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43045&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=43045&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=43045&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43045&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43045&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43045&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43045&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43045&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43045&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43045&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43045&r=mysqlcfg


Thread (7 messages)

« previous php.bugs (#118735) next »