Error parsing double values
Closed this issue · 2 comments
GoogleCodeExporter commented
What steps will reproduce the problem?
1. Write a little service and return 555.00 to the client
2. Write a little client and send 555.00 to your service
What is the expected output? What do you see instead?
The expected output in both cases is 555.00 but the value is 43!
(this works with other value too. e.g. 444.00, 333.00, 666.00)
What version of the product are you using? On what operating system?
hessianphp 2.02
Win XP SP3
Please provide any additional information below.
For some reason the double1 function is called for the given values while
parsing the hessian stream. I don't think this is right?!?
Original issue reported on code.google.com by nesnnaho...@gmail.com
on 14 Feb 2011 at 2:44
GoogleCodeExporter commented
Hello again,
we fixed the problem by modifying Hessian2Writer.php.
The function writeDouble($value) seems to have a wrong range of values in line
319:
if($frac == 0 && $this->between($value, -127, 2047)){
...
It has tob be
if($frac == 0 && $this->between($value, -128, 128)){
...
please see http://hessian.caucho.com/doc/hessian-serialization.html##double
for that.
I hope this fixed the wrong behavior for all double values.
regards
marc
Original comment by nesnnaho...@gmail.com
on 15 Feb 2011 at 10:10
GoogleCodeExporter commented
Hello Marc
Your are right, the float values the service returns were incorect.
I tested it and corrected the affected file. I created a unit test in
base_test.php (line 66) to check that the service returns back correct
scalar values. The distribution package will be updated today.
Thank you for your support!
Regards
Manolo
Original comment by vegeta...@gmail.com
on 15 Feb 2011 at 4:55
- Changed state: Fixed