Protocols.XMLRPC contains the following:
protected mixed decode(string xml_input, string dtd_input, int|void boolean) { // We cannot insert 0 integers directly into the parse tree, so // we'll use magic_zero as a placeholder and destruct it afterwards. object magic_zero = class {}();
...
case "int": return (int)(data*"") || magic_zero; ... destruct(magic_zero); // Apply Magic! Replace magic_zero with real 0:s.
unfortunately this doesn't quite work:
Pike v7.9 release 5 running Hilfe v3.5 (Incremental Pike Frontend)
object magic_zero = class {}(); mapping foo = ([ "foo":magic_zero ]); destruct(magic_zero);
Compiler Warning: 1: Returning a void expression. Converted to zero. (1) Result: 0
foreach(foo; string key; mixed val){ write("%O\n", intp(val)); }
0 Ok.
in other words, in this situation, the magic zero is not recognized as an int.
this causes for example xml-rpc-call in modules/tags/additional_rxml.pike to fail:
format_response: else if (intp (val)) buf->add ("<int>", (string) val, "</int>\n"); ... else { // Gotta be a Calendar object. // Format this to be compatible with the iso-time attribute // to the <date> tag. buf->add ("<iso-date-time>", val->format_time(), "</iso-date-time>\n"); } failing with: Internal server error: Lookup in destructed object.
On Wed, Aug 21, 2013 at 9:00 AM, Martin Bähr mbaehr@email.archlab.tuwien.ac.at wrote:
in other words, in this situation, the magic zero is not recognized as an int.
It is a zero value, though, so the check could be done as:
!val || intp(val)
But why is it that the integer 0 can't be put into the parse tree? Are there checks that need to be changed to use has_index?
ChrisA
pike-devel@lists.lysator.liu.se