Skip Menu |
 

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

Report information
The Basics
Id: 77864
Status: resolved
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors: chansen [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.97
Fixed in: 1.97



Download (untitled) / with headers
text/plain 212b
XML::LibXML broke overloading and magic in 1.97. $ perl -MXML::LibXML -le 'use overload q[""] => sub { "<xml><foo /></xml>" }; my $o = bless \(my $x); print $o; XML::LibXML->new->parse_string($o);' __ chansen
Download (untitled) / with headers
text/plain 552b
I should note that the following program works fine: <<<< #!/usr/bin/perl use strict; use warnings; use XML::LibXML; use overload q[""] => sub { "<xml><foo /></xml>\n" }; my $o = bless \(my $x); # my $o = bless []; print $o; print "\n"; XML::LibXML->new->parse_string("$o"); Show quoted text
>>>>
So wrapping the string-overloaded object reference in double quotes can be a temporary workaround for that. I think I know where the problem stems from and I'd like to investigate, but I think this will be done after the 2.0000 release. Regards, -- Shlomi Fish
Attached patch restores sanity. -- chansen
Subject: LibXML.xs.patch
Download LibXML.xs.patch
text/x-diff 1.2k
--- LibXML.xs.orig 2012-10-13 12:39:38.000000000 +0200 +++ LibXML.xs 2012-11-08 23:50:04.000000000 +0100 @@ -1599,7 +1599,7 @@ PREINIT: char * directory = NULL; STRLEN len; - char * ptr; + const char * ptr; HV * real_obj; int well_formed; int valid; @@ -1615,11 +1615,12 @@ } } /* If string is a reference to a string - dereference it. - * See: https://rt.cpan.org/Ticket/Display.html?id=64051 . */ - if (SvROK(string)) { + * See: https://rt.cpan.org/Ticket/Display.html?id=64051 (broke it) + * https://rt.cpan.org/Ticket/Display.html?id=77864 (fixed it) */ + if (SvROK(string) && !SvOBJECT(SvRV(string))) { string = SvRV(string); } - ptr = SvPV(string, len); + ptr = SvPV_const(string, len); if (len <= 0) { croak("Empty string\n"); XSRETURN_UNDEF; @@ -1628,7 +1629,7 @@ RETVAL = &PL_sv_undef; INIT_ERROR_HANDLER; { - xmlParserCtxtPtr ctxt = xmlCreateMemoryParserCtxt((const char*)ptr, len); + xmlParserCtxtPtr ctxt = xmlCreateMemoryParserCtxt(ptr, len); if (ctxt == NULL) { CLEANUP_ERROR_HANDLER; REPORT_ERROR(1);
Download (untitled) / with headers
text/plain 263b
On Thu Nov 08 18:01:06 2012, CHANSEN wrote: Show quoted text
> Attached patch restores sanity. >
Thanks for the patch (and the report). This is now fixed in XML-LibXML-2.0012 which was just uploaded to CPAN. Sorry it took me so long. Regards, -- Shlomi Fish Show quoted text
> -- > chansen


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

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.