Skip Menu | will be shut down on March 1st, 2021.

This queue is for tickets about the Net-Jabber CPAN distribution.

Report information
The Basics
Id: 18065
Status: new
Priority: 0/
Queue: Net-Jabber

Owner: Nobody in particular
Requestors: bob.faist [...]

Bug Information
Severity: Important
Broken in: 2.0
Fixed in: (no value)

Subject: RPC handling of arrays incorrect
The first issue is in the Net::Jabber::Protocol::RPCParse_Array method. This method looped through <data> nodes but the schema definition only allows 1 <data> node. This method needs to loop through all the <value> nodes that are children of the <data> node. The second issue is in the Net::Jabber::Protocol::RPCEncode_Value method. This method does not encode arrays correctly. This method tried to add a <data> node for every element in the array. There should only be I <data> node and the loop should just add <value> nodes. See the attached patch file which resolves both of these issues. The schema definition from defines the "data" element without any min or max boundaries so this means that there must be 1 and only 1 "data" element. <xs:complexType name="ArrayType"> <xs:sequence> <xs:element name="data"> <xs:complexType> <xs:sequence> <xs:element name="value" type="ValueType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType>
Subject: Protocol.patch
Download Protocol.patch
text/x-diff 827b
--- Copy of 2004-08-17 01:30:24.000000000 -0400 +++ 2006-03-08 16:24:34.929970500 -0500 @@ -2230,10 +2230,11 @@ if (ref($value) eq "ARRAY") { - my $array = $obj->AddValue()->AddArray(); + my $array = $obj->AddValue()->AddArray()->AddData(); + foreach my $data (@{$value}) { - $self->RPCEncode_Value($array->AddData(),$data); + $self->RPCEncode_Value($array,$data); } } elsif (ref($value) eq "HASH") @@ -2378,9 +2379,9 @@ my($array) = @_; my @array; - foreach my $data ($array->GetDatas()) - { - push(@array,$self->RPCParse_Value($data->GetValue())); + + foreach my $value ($array->GetDatas()->GetValue()) { + push(@array,$self->RPCParse_Value($value)); } return @array;

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to