Protocols.XMLRPC trouble parsing empty <value>s
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=3656
Reported by Dan Nelson dnelson_1901@yahoo.com
According to the XMLRPC spec, s should have a within them, but "If no type is indicated, the type is string." Pike can handle untyped strings except for the empty string case:
> Protocols.XMLRPC.decode_call("<?xml
version=\"1.0\"?><methodCall><methodName>test</methodName><params><param><value>hi</value></param></params></methodCall>");
(1) Result: Protocols.XMLRPC.Call("test", 1 param)
> Protocols.XMLRPC.decode_call("<?xml
version=\"1.0\"?><methodCall><methodName>test</methodName><params><param><value></value></param></params></methodCall>");
Attempt to index the empty array with 0.
/usr/local/pike/7.5.21/lib/modules/Protocols.pmod/XMLRPC.pmod/module.pmod:226:
Protocols.XMLRPC->__lambda_66003_2_line_191(">","value",([]),({}),mapping[1])
>
Fix:
Index: module.pmod
===================================================================
RCS file: /cvs/Pike/7.5/lib/modules/Protocols.pmod/XMLRPC.pmod/module.pmod,v
retrieving revision 1.24
diff -u -r1.24 module.pmod
--- module.pmod 25 Feb 2004 10:48:35 -0000 1.24
+++ module.pmod 28 Apr 2004 04:49:12 -0000
@@ -223,7 +223,7 @@
return value->s;
return value;
}
- return data[0];
+ return sizeof(data)?data[0]:"";
case "i4":
case "int":
case "boolean":
Applies to 7.4 - 7.6