Skip Menu |

This queue is for tickets about the WDDX CPAN distribution.

Report information
The Basics
Id: 5124
Status: open
Priority: 0/
Queue: WDDX

People
Owner: Nobody in particular
Requestors: frantisekb [...] roamsecure.net
Cc:
AdminCc:

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



Subject: WDDX::Array does not deserialize empty arrays
Parser fails trying to deserialize empty arrays. If a block such as <var name='somearray'><array length='0'></array></var> comes in, WDDX::Array will die here 227 unless ( $attribs->{'length'} + 0 ) { 228 die "Invalid value for length attribute in <array> tag"; 229 } even though empty array (as serialized by WDDX itself) should be valid and processed correctly.
From: stuart [...] morungos.com
On Thu Jan 29 23:19:16 2004, guest wrote: Show quoted text
> Parser fails trying to deserialize empty arrays.
Yep, here's a patch I use - this was a showstopper for me too. There are probably more elegant solutions, and it should also be a test I guess
Subject: wddx.patch
--- Downloads/WDDX-1.02/WDDX/Array.pm 2003-10-28 12:00:51.000000000 -0500 +++ Documents/workspace/ARM/lib/WDDX/Array.pm 2009-07-13 21:19:39.000000000 -0400 @@ -224,7 +224,7 @@ my $parse_var = $self->parse_var; if ( $element eq "array" and not $self->{seen_arrays}++ ) { - unless ( $attribs->{'length'} + 0 ) { + unless ( $attribs->{'length'} =~ /^\d+$/ ) { die "Invalid value for length attribute in <array> tag"; } $self->{'length'} = $attribs->{'length'};