Skip Menu |

This queue is for tickets about the RPC-XML CPAN distribution.

Report information
The Basics
Id: 31818
Status: resolved
Priority: 0/
Queue: RPC-XML

People
Owner: Nobody in particular
Requestors: byrdhuntr [...] hotmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.59
Fixed in: 0.60



Subject: Very small/large double values not following spec
When returning the numeric value '0.000005', RPC::XML::Server will output the exponential form of the number. <value><double>5.0E-6</double></value> This violates the xmlrpc spec on double values. The relevant section taken from http://www.xmlrpc.com/spec is: ----- Q: What is the legal syntax (and range) for floating point values (doubles)? How is the exponent represented? How to deal with whitespace? Can infinity and "not a number" be represented? A: There is no representation for infinity or negative infinity or "not a number". At this time, only decimal point notation is allowed, a plus or a minus, followed by any number of numeric characters, followed by a period and any number of numeric characters. Whitespace is not allowed. The range of allowable values is implementation-dependent, is not specified. ----- I can confirm that this breaks PHP's xmlrpc client, which errors out on these values.
Subject: RPC::XML patch for [rt.cpan.org #31818]
Date: Fri, 21 Dec 2007 13:44:15 -0800
To: <rjray [...] blackperl.com>, <bug-rpc-xml [...] rt.cpan.org>
From: Sean Tobin <byrdhuntr [...] hotmail.com>
The problem with RPC::XML::Server returning very small/large doubles in exponential format can be fixed in RPC::XML.pm. Specifically, by forcing $value to be a floating-point string we can guarantee that it won't be sent in exponential format. This patch implements that conversion 310a312,324 Show quoted text
> sub new > { > my $class = shift; > my $value = shift; > > #Make sure that the value is in decimal format. Values > #in the format 0.0E0 are not valid XML-RPC doubles > $value=sprintf("%f",$value); > > RPC::XML::simple_type::new($class,$value); > } >
I haven't tested it against all cases, but it has fixed my problems with PHP's XML-RPC client. Also, there may be a way to force Perl to not send a exponential value without forcing it to a string, but I don't know of one. Sean Tobin byrdhuntr@hotmail.com Show quoted text
> Subject: [rt.cpan.org #31818] AutoReply: Very small/large double values not following spec > From: bug-RPC-XML@rt.cpan.org > To: byrdhuntr@hotmail.com > Date: Fri, 21 Dec 2007 15:44:03 -0500 > > > Greetings, > > This message has been automatically generated in response to the > creation of a trouble ticket regarding: > "Very small/large double values not following spec", > a summary of which appears below. > > There is no need to reply to this message right now. Your ticket has been > assigned an ID of [rt.cpan.org #31818]. Your ticket is accessible > on the web at: > > http://rt.cpan.org/Ticket/Display.html?id=31818 > > Please include the string: > > [rt.cpan.org #31818] > > in the subject line of all future correspondence about this issue. To do so, > you may reply to this message. > > Thank you, > bug-RPC-XML@rt.cpan.org > > ------------------------------------------------------------------------- > When returning the numeric value '0.000005', RPC::XML::Server will > output the exponential form of the number. > > 5.0E-6 > > This violates the xmlrpc spec on double values. The relevant section > taken from http://www.xmlrpc.com/spec is: > > ----- > Q: What is the legal syntax (and range) for floating point values > (doubles)? How is the exponent represented? How to deal with whitespace? > Can infinity and "not a number" be represented? > > A: There is no representation for infinity or negative infinity or "not > a number". At this time, only decimal point notation is allowed, a plus > or a minus, followed by any number of numeric characters, followed by a > period and any number of numeric characters. Whitespace is not allowed. > The range of allowable values is implementation-dependent, is not specified. > ----- > > I can confirm that this breaks PHP's xmlrpc client, which errors out on > these values.
Show quoted text
_________________________________________________________________ i’m is proud to present Cause Effect, a series about real people making a difference. http://im.live.com/Messenger/IM/MTV/?source=text_Cause_Effect
This fix was applied, but required a little more finesse as the "%f" format defaulted to 5 decimal places, which isn't ideal for double-precision data.