Subject: | RPCEncode_Value encodes arrays incorrectly |
Net-Jabber-2.0
The RPC code to encode arrays is incorrect. According to the spec, arrays should look like:
<array>
<data>
<value><i4>12</i4></value>
<value><string>Egypt</string></value>
<value><boolean>0</boolean></value>
<value><i4>-31</i4></value>
</data>
</array>
RPCEncode_Value encodes arrays like:
<array>
<data>
<value>
<i4>10</i4>
</value>
</data>
<data>
<value>
<i4>28</i4>
</value>
</data>
<data>
<value>
<i4>20</i4>
</value>
</data>
</array>
Note the extra <data/> tags. Here's the fix:
--- Protocol_old.pm 2005-10-28 14:54:30.000000000 -0700
+++ Protocol.pm 2005-10-28 15:14:28.137104112 -0700
@@ -2231,9 +2231,10 @@
if (ref($value) eq "ARRAY")
{
my $array = $obj->AddValue()->AddArray();
+ my $dataObj = $array->AddData();
foreach my $data (@{$value})
{
- $self->RPCEncode_Value($array->AddData(),$data);
+ $self->RPCEncode_Value($dataObj,$data);
}
}
elsif (ref($value) eq "HASH")