Skip Menu |

This queue is for tickets about the XML-Simple CPAN distribution.

Report information
The Basics
Id: 114120
Status: resolved
Priority: 0/
Queue: XML-Simple

People
Owner: grantm [...] cpan.org
Requestors: NEPOS [...] cpan.org
Cc:
AdminCc:

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



Subject: Regression with circular data structure detection?
Hello, With the new version 2.22 of XML::Simple suddenly pretty old code stops to work due to a circular data structure being detected. I looked into your code and I think, the removal of refs from $self->{_ancestors} is wrong in this form because some of the code in value_to_xml() modifies $ref. The attached patch fixes the problem for me. Greetings, Matthias
Subject: XML_Simple.patch
--- lib/XML/Simple.pm.orig 2016-05-02 11:22:13.714872555 +0200 +++ lib/XML/Simple.pm 2016-05-02 11:22:44.027023037 +0200 @@ -1428,6 +1428,7 @@ sub value_to_xml { # Convert to XML + my $orig_ref = $ref; if(my $refaddr = Scalar::Util::refaddr($ref)) { croak "circular data structures not supported" if $self->{_ancestors}->{$refaddr}; @@ -1649,7 +1650,7 @@ sub value_to_xml { } - if(my $refaddr = Scalar::Util::refaddr($ref)) { + if(my $refaddr = Scalar::Util::refaddr($orig_ref)) { delete $self->{_ancestors}->{$refaddr}; }
Thanks you for the report. I apologise for taking so long to respond. I've uploaded version 2.23 of XML::Simple with a fix for this issue. Regards Grant