pxd119 / as3-rpclib

Automatically exported from code.google.com/p/as3-rpclib
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

XMLRPC - Serialize Boolean Values - Bug in AS3 affects XMLRPCSerializer.decodeObject() #6

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

A return value (Boolean-Type) of an XML-RPC-Call from AS3 to Python is
supposed to be decoded as Boolean-Values true or false.

In my case any Boolean-Value was decoded as true.

The problem seems to be the statement "return Boolean(robject.boolean);" in
XMLRPCSerializer.decodeObject().

I did a test in AS3:
trace(new Boolean("1")) returns true
trace(new Boolean("0")) returns true, but I expect to return false.

What version of the product are you using? On what operating system?

WinXP, AIR beta 2, Python2.5

Please provide any additional information below.

Here are my work-a-rounds, but actually I would prefere not to edit
provided source codes. 

Class: XMLRPCSerializer

private static function decodeObject (robject:*):*
{
    if (robject.children().name() == TYPE_STRING)
    {
     ...

    else if (robject.children().name() == TYPE_BOOLEAN)
    {
        //original code:
        //return Boolean(robject.boolean);

        //Problem:
        //trace(new Boolean("0"))-->true
                //trace(new Boolean("1"))-->true

                //Workarounds: 

                //Version 1:
        return Boolean(Number(robject.boolean));

                //Version2:
        //if (robject.boolean=="1") {return true;}
        //if (robject.boolean=="true") {return true;}
        //if (robject.boolean=="True") {return true;}
        //if (robject.boolean=="0") {return false;}
        //if (robject.boolean=="false") {return false;}
        //if (robject.boolean=="False") {return false;}
    }
    else if (robject.children().name()== TYPE_DATE)
    { 
                ...

Original issue reported on code.google.com by bastma...@gmail.com on 5 Dec 2007 at 12:31

GoogleCodeExporter commented 8 years ago

Original comment by akeemphi...@gmail.com on 5 Dec 2007 at 8:19

GoogleCodeExporter commented 8 years ago

Original comment by akeemphi...@gmail.com on 7 Dec 2007 at 5:09