What steps will reproduce the problem?
1. Connect to an XML-RPC service
var service= new rpc.ServiceProxy("/local/service/", {asynchronous:false,
protocol: 'XML-RPC', methods: ['add_float']});
2. Call a function that takes float values as input and provide a negative float
var pt = service.add_float(-111.1111, 56.1111);
What is the expected output? What do you see instead?
The formed XML request will be invalid when a negative float is given. It will
be incorrectly advertised as an int type causing an error on most XML-RPC
servers.
What version of the product are you using? On what operating system?
- rpc-client-javascript-0.8.0.2
- firefox 3.6.13
Please provide any additional information below.
The problem seems to be on line 669 where the library is discovering the type
of the input. It uses "if(parseInt(value) == Math.ceil(value))" which will only
work for positive floats. A function something like the following could be used
instead.
function isFloat(num)
{
ret = num%Math.floor(num);
if(ret == 0 || isNaN(ret) == true)
{
return false;
}
else
{
return true;
}
}
Original issue reported on code.google.com by angus.di...@gmail.com on 11 Feb 2011 at 5:42
Original issue reported on code.google.com by
angus.di...@gmail.com
on 11 Feb 2011 at 5:42