Skip Menu |

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

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

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

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



Subject: xpath segfault
When I try to treat a DocumentFragment as a real Document node, and use xpath like '/whatever', I get a segfault. I'm not sure whether I should get the expected results (would be very convenient if it worked), but I don't think XML::LibXML should segfault. I attached a little script that demonstrates that travelling up the tree yourself ends correctly because the DocumentFragment has no parent node, but trying to use an xpath expression that would need to do the same segfaults.
Subject: testlibxml.pl
use XML::LibXML; my $df = XML::LibXML::DocumentFragment->new; my $xpc = XML::LibXML::XPathContext->new; $xpc->registerNs('meh', 'some:namespace'); my $node = $df->addNewChild('some:namespace', 'meh:foo'); my $child = $node->addNewChild('some:namespace', 'meh:bar'); my $search = $node->addNewChild('some:namespace', 'meh:baz'); my $test = $search; while ($test = $test->parentNode) { warn $test->nodeName; } my @result; foreach my $xpath ('../meh:bar', '//meh:foo/meh:bar') { @result = $xpc->findnodes($xpath, $search); warn map {$_->toString} @result; }
Hi, this seems to be fixed since I can't reproduce the segfault with neither latest SVN version nor the latest developer's release 1.69_2; valgrind doesn't report any problem with your testcase either. And yes, you can't expect /anything to match on a non-document node. -- Petr Show quoted text
> When I try to treat a DocumentFragment as a real Document node, and
use Show quoted text
> xpath like '/whatever', I get a segfault. I'm not sure whether I
should Show quoted text
> get the expected results (would be very convenient if it worked),
but I Show quoted text
> don't think XML::LibXML should segfault. > > I attached a little script that demonstrates that travelling up the
tree Show quoted text
> yourself ends correctly because the DocumentFragment has no parent
node, Show quoted text
> but trying to use an xpath expression that would need to do the same > segfaults.