diff options
author | TizenOpenSource <tizenopensrc@samsung.com> | 2024-02-15 11:02:19 +0900 |
---|---|---|
committer | TizenOpenSource <tizenopensrc@samsung.com> | 2024-02-15 11:02:19 +0900 |
commit | ce4b3717c547a8747a30be857a4f29b9dccbb9e2 (patch) | |
tree | a926d795f9867f696c0cbd5dfa585714c128f2a1 | |
parent | 9f45becdcc247e15d9308c5adfc4335e2c3a2e6e (diff) | |
download | perl-XML-LibXML-upstream.tar.gz perl-XML-LibXML-upstream.tar.bz2 perl-XML-LibXML-upstream.zip |
Imported Upstream version 2.0209upstream/2.0209upstream
53 files changed, 166 insertions, 104 deletions
@@ -1,5 +1,19 @@ Revision history for Perl extension XML::LibXML +2.0209 2023-07-15 + - t/35huge_mode.t: fix test with libxml2 2.11 + - thanks to Dominique Martinet + - Add clearer reference to using cloneNode to extract node with namespaces + - thanks to Timothy Legge + - initialize xmlValidCtxt + - thanks to Alexander Bluhm + +2.0208 2022-09-30 + - Fix https://rt.cpan.org/Ticket/Display.html?id=144415 + - Bug #144415 for XML-LibXML: createElementNS & setNamespace get + confused by Readonly scalars + - thanks to DAKKAR and haarg. + 2.0207 2021-04-17 - Small cleanups: - https://github.com/shlomif/perl-XML-LibXML/pull/63 @@ -29,7 +29,7 @@ use XML::LibXML::XPathContext; use IO::Handle; # for FH reads called as methods BEGIN { -$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0209"; # VERSION TEMPLATE: DO NOT CHANGE $ABI_VERSION = 2; require Exporter; use XSLoader (); @@ -507,7 +507,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT @@ -4025,18 +4025,11 @@ is_valid(self, ...) CODE: INIT_ERROR_HANDLER; + memset(&cvp, 0, sizeof(cvp)); cvp.userData = saved_error; cvp.error = (xmlValidityErrorFunc)LibXML_validity_error_ctx; cvp.warning = (xmlValidityWarningFunc)LibXML_validity_warning_ctx; - /* we need to initialize the node stack, because perl might - * already have messed it up. - */ - cvp.nodeNr = 0; - cvp.nodeTab = NULL; - cvp.vstateNr = 0; - cvp.vstateTab = NULL; - PmmClearPSVI(self); PmmInvalidatePSVI(self); if (items > 1) { @@ -4065,16 +4058,10 @@ validate(self, ...) CODE: INIT_ERROR_HANDLER; + memset(&cvp, 0, sizeof(cvp)); cvp.userData = saved_error; cvp.error = (xmlValidityErrorFunc)LibXML_validity_error_ctx; cvp.warning = (xmlValidityWarningFunc)LibXML_validity_warning_ctx; - /* we need to initialize the node stack, because perl might - * already have messed it up. - */ - cvp.nodeNr = 0; - cvp.nodeTab = NULL; - cvp.vstateNr = 0; - cvp.vstateTab = NULL; PmmClearPSVI(self); PmmInvalidatePSVI(self); @@ -5747,7 +5734,7 @@ _setNamespace(self, namespaceURI, namespacePrefix = &PL_sv_undef, flag = 1 ) CODE: /* if ( !nsURI ){ XSRETURN_UNDEF; - } */ + } */ nsPrefix = nodeSv2C(namespacePrefix, node); if ( xmlStrlen( nsPrefix ) == 0 ) { @@ -5759,22 +5746,22 @@ _setNamespace(self, namespaceURI, namespacePrefix = &PL_sv_undef, flag = 1 ) nsURI = NULL; } if ( nsPrefix == NULL && nsURI == NULL ) { - /* special case: empty namespace */ - if ( (ns = xmlSearchNs(node->doc, node, NULL)) && - ( ns->href && xmlStrlen( ns->href ) != 0 ) ) { - /* won't take it */ - RETVAL = 0; - } else if ( flag ) { - /* no namespace */ - xmlSetNs(node, NULL); - RETVAL = 1; - } else { - RETVAL = 0; - } - } + /* special case: empty namespace */ + if ( (ns = xmlSearchNs(node->doc, node, NULL)) && + ( ns->href && xmlStrlen( ns->href ) != 0 ) ) { + /* won't take it */ + RETVAL = 0; + } else if ( flag ) { + /* no namespace */ + xmlSetNs(node, NULL); + RETVAL = 1; + } else { + RETVAL = 0; + } + } else if ( flag && (ns = xmlSearchNs(node->doc, node, nsPrefix)) ) { - /* user just wants to set the namespace for the node */ - /* try to reuse an existing declaration for the prefix */ + /* user just wants to set the namespace for the node */ + /* try to reuse an existing declaration for the prefix */ if ( xmlStrEqual( ns->href, nsURI ) ) { RETVAL = 1; } @@ -5786,9 +5773,9 @@ _setNamespace(self, namespaceURI, namespacePrefix = &PL_sv_undef, flag = 1 ) } } else if ( (ns = xmlNewNs( node, nsURI, nsPrefix )) ) - RETVAL = 1; - else - RETVAL = 0; + RETVAL = 1; + else + RETVAL = 0; if ( flag && ns ) { xmlSetNs(node, ns); @@ -193,6 +193,7 @@ t/lib/Collector.pm t/lib/Counter.pm t/lib/Stacker.pm t/lib/TestHelpers.pm +t/namespace-magic-scalar-rt144415.t t/pod-files-presence.t t/pod.t t/release-kwalitee.t @@ -4,7 +4,7 @@ "Petr Pajas <PAJAS@cpan.org>" ], "dynamic_config" : 0, - "generated_by" : "ExtUtils::MakeMaker version 7.60, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.70, CPAN::Meta::Converter version 2.150010", "keywords" : [ "dom", "html", @@ -97,6 +97,6 @@ "web" : "https://github.com/shlomif/perl-XML-LibXML" } }, - "version" : "2.0207", - "x_serialization_backend" : "JSON::PP version 4.06" + "version" : "2.0209", + "x_serialization_backend" : "JSON::PP version 4.16" } @@ -19,7 +19,7 @@ configure_requires: Config: '0' ExtUtils::MakeMaker: '0' dynamic_config: 0 -generated_by: 'ExtUtils::MakeMaker version 7.60, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.70, CPAN::Meta::Converter version 2.150010' keywords: - dom - html @@ -69,5 +69,5 @@ requires: warnings: '0' resources: repository: https://github.com/shlomif/perl-XML-LibXML.git -version: '2.0207' +version: '2.0209' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff --git a/Makefile.PL b/Makefile.PL index 3d1902e..98f8cc1 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -68,11 +68,15 @@ my %prereqs = ( "warnings" => 0, ); -my %xsbuild = ( +my %xsbuild_concat = ( DEFINE => '-DHAVE_UTF8', OBJECT => '$(O_FILES)', - Alien::Base::Wrapper->mm_args, ); +my %xsbuild = Alien::Base::Wrapper->mm_args; # Might contain a definition of DEFINE, must thus concatenate. +while (my ($k, $v) = each %xsbuild_concat) { + my $base_val = $xsbuild{$k}; + $xsbuild{$k} = (defined($base_val) ? ($base_val . ' ' . $v) : $v); +} my %WriteMakefileArgs = ( "NAME" => "XML::LibXML", diff --git a/docs/libxml.dbk b/docs/libxml.dbk index c7a4208..371c5c0 100644 --- a/docs/libxml.dbk +++ b/docs/libxml.dbk @@ -22,7 +22,7 @@ </authorgroup> - <edition>2.0207</edition> + <edition>2.0209</edition> <copyright> <year>2001-2007</year> <holder>AxKit.com Ltd</holder> @@ -2598,7 +2598,9 @@ print {$out_fh} $doc->toString;</programlisting> </funcsynopsis> <para><emphasis>toStringHTML</emphasis> serialize the tree to a byte string in the document encoding as HTML. With this method indenting is automatic and managed by - libxml2 internally.</para> + libxml2 internally. Note the string must contain + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> (rather than the newer <meta charset="utf-8">), + else all non-ASCII will become entities.</para> </listitem> </varlistentry> @@ -3396,6 +3398,13 @@ my $dtd = $document->createInternalSubset( "foo", "-//FOO//DTD FOO 0.1// has changed in 1.62 in order to be consistent with the DOM spec (in older versions attributes and namespace information was not copied for elements).</para> + <para><emphasis>NOTE</emphasis>cloneNode creates + a copy of the selected node that includes the parent's + defined <emphasis>namespaces</emphasis> that are in + use by the node (or its children) being cloned. That + makes it useful for extracting a fragment of xml that + can be used as a valid xml document. + </para> </listitem> </varlistentry> diff --git a/lib/XML/LibXML/Attr.pod b/lib/XML/LibXML/Attr.pod index fa6a5cd..94bd691 100644 --- a/lib/XML/LibXML/Attr.pod +++ b/lib/XML/LibXML/Attr.pod @@ -121,7 +121,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/AttributeHash.pm b/lib/XML/LibXML/AttributeHash.pm index c83f0dc..87ca8bd 100644 --- a/lib/XML/LibXML/AttributeHash.pm +++ b/lib/XML/LibXML/AttributeHash.pm @@ -7,7 +7,7 @@ use Tie::Hash; our @ISA = qw/Tie::Hash/; use vars qw($VERSION); -$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0209"; # VERSION TEMPLATE: DO NOT CHANGE BEGIN { diff --git a/lib/XML/LibXML/Boolean.pm b/lib/XML/LibXML/Boolean.pm index faa53b7..7e3da31 100644 --- a/lib/XML/LibXML/Boolean.pm +++ b/lib/XML/LibXML/Boolean.pm @@ -16,7 +16,7 @@ use warnings; use vars qw ($VERSION); -$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0209"; # VERSION TEMPLATE: DO NOT CHANGE use overload '""' => \&value, diff --git a/lib/XML/LibXML/CDATASection.pod b/lib/XML/LibXML/CDATASection.pod index 1113e56..996e025 100644 --- a/lib/XML/LibXML/CDATASection.pod +++ b/lib/XML/LibXML/CDATASection.pod @@ -45,7 +45,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Comment.pod b/lib/XML/LibXML/Comment.pod index aaacdce..9ae60a2 100644 --- a/lib/XML/LibXML/Comment.pod +++ b/lib/XML/LibXML/Comment.pod @@ -46,7 +46,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Common.pm b/lib/XML/LibXML/Common.pm index eb7681c..e478972 100644 --- a/lib/XML/LibXML/Common.pm +++ b/lib/XML/LibXML/Common.pm @@ -23,7 +23,7 @@ use vars qw( @ISA $VERSION @EXPORT @EXPORT_OK %EXPORT_TAGS); @ISA = qw(Exporter); -$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0209"; # VERSION TEMPLATE: DO NOT CHANGE use XML::LibXML qw(:libxml); diff --git a/lib/XML/LibXML/Common.pod b/lib/XML/LibXML/Common.pod index 9423109..d17ffab 100644 --- a/lib/XML/LibXML/Common.pod +++ b/lib/XML/LibXML/Common.pod @@ -116,7 +116,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/DOM.pod b/lib/XML/LibXML/DOM.pod index d01e75a..08fef1c 100644 --- a/lib/XML/LibXML/DOM.pod +++ b/lib/XML/LibXML/DOM.pod @@ -129,7 +129,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Devel.pm b/lib/XML/LibXML/Devel.pm index 8f13912..7297bed 100644 --- a/lib/XML/LibXML/Devel.pm +++ b/lib/XML/LibXML/Devel.pm @@ -12,7 +12,7 @@ use warnings; use XML::LibXML; use vars qw ($VERSION); -$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0209"; # VERSION TEMPLATE: DO NOT CHANGE use 5.008_000; diff --git a/lib/XML/LibXML/Document.pod b/lib/XML/LibXML/Document.pod index 2cdc576..f433f9b 100644 --- a/lib/XML/LibXML/Document.pod +++ b/lib/XML/LibXML/Document.pod @@ -325,7 +325,10 @@ The format parameter has the same behaviour as in toString(). $str = $document->toStringHTML(); I<<<<<< toStringHTML >>>>>> serialize the tree to a byte string in the document encoding as HTML. With this -method indenting is automatic and managed by libxml2 internally. +method indenting is automatic and managed by libxml2 internally. Note the +string must contain <meta http-equiv="Content-Type" content="text/html; +charset=utf-8"> (rather than the newer <meta charset="utf-8">), else all +non-ASCII will become entities. =item serialize_html @@ -683,7 +686,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/DocumentFragment.pod b/lib/XML/LibXML/DocumentFragment.pod index 61e741c..b015d05 100644 --- a/lib/XML/LibXML/DocumentFragment.pod +++ b/lib/XML/LibXML/DocumentFragment.pod @@ -27,7 +27,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Dtd.pod b/lib/XML/LibXML/Dtd.pod index 294cb17..f82dd86 100644 --- a/lib/XML/LibXML/Dtd.pod +++ b/lib/XML/LibXML/Dtd.pod @@ -89,7 +89,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Element.pod b/lib/XML/LibXML/Element.pod index f6f0b74..044bd90 100644 --- a/lib/XML/LibXML/Element.pod +++ b/lib/XML/LibXML/Element.pod @@ -382,7 +382,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/ErrNo.pm b/lib/XML/LibXML/ErrNo.pm index 0fa6308..9a8450b 100644 --- a/lib/XML/LibXML/ErrNo.pm +++ b/lib/XML/LibXML/ErrNo.pm @@ -14,7 +14,7 @@ use strict; use warnings; use vars qw($VERSION); -$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0209"; # VERSION TEMPLATE: DO NOT CHANGE use constant ERR_OK => 0; use constant ERR_INTERNAL_ERROR => 1; diff --git a/lib/XML/LibXML/ErrNo.pod b/lib/XML/LibXML/ErrNo.pod index 4b1b59e..a32ce63 100644 --- a/lib/XML/LibXML/ErrNo.pod +++ b/lib/XML/LibXML/ErrNo.pod @@ -17,7 +17,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Error.pm b/lib/XML/LibXML/Error.pm index 9855eaf..ebf1641 100644 --- a/lib/XML/LibXML/Error.pm +++ b/lib/XML/LibXML/Error.pm @@ -28,7 +28,7 @@ use overload fallback => 1; $WARNINGS = 0; # 0: suppress, 1: report via warn, 2: report via die -$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0209"; # VERSION TEMPLATE: DO NOT CHANGE use constant XML_ERR_NONE => 0; use constant XML_ERR_WARNING => 1; # A simple warning diff --git a/lib/XML/LibXML/Error.pod b/lib/XML/LibXML/Error.pod index b8915e3..4896be8 100644 --- a/lib/XML/LibXML/Error.pod +++ b/lib/XML/LibXML/Error.pod @@ -244,7 +244,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/InputCallback.pod b/lib/XML/LibXML/InputCallback.pod index 3cfcd15..79ebdd8 100644 --- a/lib/XML/LibXML/InputCallback.pod +++ b/lib/XML/LibXML/InputCallback.pod @@ -280,7 +280,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Literal.pm b/lib/XML/LibXML/Literal.pm index 1bc9fa1..06b42b5 100644 --- a/lib/XML/LibXML/Literal.pm +++ b/lib/XML/LibXML/Literal.pm @@ -16,7 +16,7 @@ use strict; use warnings; use vars qw ($VERSION); -$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0209"; # VERSION TEMPLATE: DO NOT CHANGE use overload '""' => \&value, diff --git a/lib/XML/LibXML/Namespace.pod b/lib/XML/LibXML/Namespace.pod index 85d5598..26c2200 100644 --- a/lib/XML/LibXML/Namespace.pod +++ b/lib/XML/LibXML/Namespace.pod @@ -141,7 +141,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Node.pod b/lib/XML/LibXML/Node.pod index 6f8e9a5..74cda2c 100644 --- a/lib/XML/LibXML/Node.pod +++ b/lib/XML/LibXML/Node.pod @@ -279,6 +279,11 @@ Note that the behavior of this function for $deep=0 has changed in 1.62 in order to be consistent with the DOM spec (in older versions attributes and namespace information was not copied for elements). +I<<<<<< NOTE >>>>>>cloneNode creates a copy of the selected node that includes the parent's +defined I<<<<<< namespaces >>>>>> that are in use by the node (or its children) being cloned. That makes it +useful for extracting a fragment of xml that can be used as a valid xml +document. + =item parentNode @@ -763,7 +768,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/NodeList.pm b/lib/XML/LibXML/NodeList.pm index ca748d9..8bd58cf 100644 --- a/lib/XML/LibXML/NodeList.pm +++ b/lib/XML/LibXML/NodeList.pm @@ -17,7 +17,7 @@ use XML::LibXML::Literal; use XML::LibXML::Number; use vars qw($VERSION); -$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0209"; # VERSION TEMPLATE: DO NOT CHANGE use overload '""' => \&to_literal, diff --git a/lib/XML/LibXML/Number.pm b/lib/XML/LibXML/Number.pm index cddd4c0..feb3d39 100644 --- a/lib/XML/LibXML/Number.pm +++ b/lib/XML/LibXML/Number.pm @@ -14,7 +14,7 @@ use strict; use warnings; use vars qw ($VERSION); -$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0209"; # VERSION TEMPLATE: DO NOT CHANGE use overload '""' => \&value, diff --git a/lib/XML/LibXML/PI.pod b/lib/XML/LibXML/PI.pod index 99323ff..22502c7 100644 --- a/lib/XML/LibXML/PI.pod +++ b/lib/XML/LibXML/PI.pod @@ -74,7 +74,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Parser.pod b/lib/XML/LibXML/Parser.pod index 034395d..c46cd11 100644 --- a/lib/XML/LibXML/Parser.pod +++ b/lib/XML/LibXML/Parser.pod @@ -988,7 +988,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Pattern.pod b/lib/XML/LibXML/Pattern.pod index 3cf4d72..4317098 100644 --- a/lib/XML/LibXML/Pattern.pod +++ b/lib/XML/LibXML/Pattern.pod @@ -94,7 +94,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Reader.pm b/lib/XML/LibXML/Reader.pm index 40f093c..8752737 100644 --- a/lib/XML/LibXML/Reader.pm +++ b/lib/XML/LibXML/Reader.pm @@ -14,7 +14,7 @@ use strict; use warnings; use vars qw ($VERSION); -$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0209"; # VERSION TEMPLATE: DO NOT CHANGE use 5.008_000; diff --git a/lib/XML/LibXML/Reader.pod b/lib/XML/LibXML/Reader.pod index 094e852..234787a 100644 --- a/lib/XML/LibXML/Reader.pod +++ b/lib/XML/LibXML/Reader.pod @@ -657,7 +657,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/RegExp.pod b/lib/XML/LibXML/RegExp.pod index 0ef9b6e..817aaeb 100644 --- a/lib/XML/LibXML/RegExp.pod +++ b/lib/XML/LibXML/RegExp.pod @@ -58,7 +58,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/RelaxNG.pod b/lib/XML/LibXML/RelaxNG.pod index a05d583..dbeccd4 100644 --- a/lib/XML/LibXML/RelaxNG.pod +++ b/lib/XML/LibXML/RelaxNG.pod @@ -73,7 +73,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/SAX.pm b/lib/XML/LibXML/SAX.pm index 681499e..deff54d 100644 --- a/lib/XML/LibXML/SAX.pm +++ b/lib/XML/LibXML/SAX.pm @@ -14,7 +14,7 @@ use warnings; use vars qw($VERSION @ISA); -$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0209"; # VERSION TEMPLATE: DO NOT CHANGE use XML::LibXML; use XML::SAX::Base; diff --git a/lib/XML/LibXML/SAX.pod b/lib/XML/LibXML/SAX.pod index dc736f7..cff0763 100644 --- a/lib/XML/LibXML/SAX.pod +++ b/lib/XML/LibXML/SAX.pod @@ -47,7 +47,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/SAX/Builder.pm b/lib/XML/LibXML/SAX/Builder.pm index c16ee87..f7709eb 100644 --- a/lib/XML/LibXML/SAX/Builder.pm +++ b/lib/XML/LibXML/SAX/Builder.pm @@ -21,7 +21,7 @@ sub CLONE_SKIP { return $XML::LibXML::__threads_shared ? 0 : 1; } -$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0209"; # VERSION TEMPLATE: DO NOT CHANGE sub new { my $class = shift; diff --git a/lib/XML/LibXML/SAX/Builder.pod b/lib/XML/LibXML/SAX/Builder.pod index c199c2f..c35e493 100644 --- a/lib/XML/LibXML/SAX/Builder.pod +++ b/lib/XML/LibXML/SAX/Builder.pod @@ -38,7 +38,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/SAX/Generator.pm b/lib/XML/LibXML/SAX/Generator.pm index 2ae881f..0680516 100644 --- a/lib/XML/LibXML/SAX/Generator.pm +++ b/lib/XML/LibXML/SAX/Generator.pm @@ -15,7 +15,7 @@ use warnings; use XML::LibXML; use vars qw ($VERSION); -$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0209"; # VERSION TEMPLATE: DO NOT CHANGE sub CLONE_SKIP { return $XML::LibXML::__threads_shared ? 0 : 1; diff --git a/lib/XML/LibXML/SAX/Parser.pm b/lib/XML/LibXML/SAX/Parser.pm index 0b2ba85..d4c4abc 100644 --- a/lib/XML/LibXML/SAX/Parser.pm +++ b/lib/XML/LibXML/SAX/Parser.pm @@ -18,7 +18,7 @@ use XML::LibXML::Common qw(:libxml); use XML::SAX::Base; use XML::SAX::DocumentLocator; -$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0209"; # VERSION TEMPLATE: DO NOT CHANGE @ISA = ('XML::SAX::Base'); sub CLONE_SKIP { diff --git a/lib/XML/LibXML/Schema.pod b/lib/XML/LibXML/Schema.pod index 5bfc958..020552f 100644 --- a/lib/XML/LibXML/Schema.pod +++ b/lib/XML/LibXML/Schema.pod @@ -69,7 +69,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Text.pod b/lib/XML/LibXML/Text.pod index be65280..53099da 100644 --- a/lib/XML/LibXML/Text.pod +++ b/lib/XML/LibXML/Text.pod @@ -170,7 +170,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/XPathContext.pm b/lib/XML/LibXML/XPathContext.pm index 10e62ed..7085cfa 100644 --- a/lib/XML/LibXML/XPathContext.pm +++ b/lib/XML/LibXML/XPathContext.pm @@ -17,7 +17,7 @@ use Carp; use XML::LibXML; use XML::LibXML::NodeList; -$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0209"; # VERSION TEMPLATE: DO NOT CHANGE # should LibXML XPath data types be used for simple objects # when passing parameters to extension functions (default: no) diff --git a/lib/XML/LibXML/XPathContext.pod b/lib/XML/LibXML/XPathContext.pod index 0b8f81c..10e84b4 100644 --- a/lib/XML/LibXML/XPathContext.pod +++ b/lib/XML/LibXML/XPathContext.pod @@ -362,7 +362,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/XPathExpression.pod b/lib/XML/LibXML/XPathExpression.pod index 5ff7b0d..3cd91ed 100644 --- a/lib/XML/LibXML/XPathExpression.pod +++ b/lib/XML/LibXML/XPathExpression.pod @@ -52,7 +52,7 @@ Petr Pajas =head1 VERSION -2.0207 +2.0209 =head1 COPYRIGHT diff --git a/perl-libxml-mm.c b/perl-libxml-mm.c index b433c5c..a3e78a2 100644 --- a/perl-libxml-mm.c +++ b/perl-libxml-mm.c @@ -1118,6 +1118,7 @@ Sv2C( SV* scalar, const xmlChar *encoding ) dTHX; xs_warn("SV2C: start!\n"); + SvGETMAGIC(scalar); if ( scalar != NULL && SvOK(scalar) ) { STRLEN len = 0; char * t_pv =SvPV(scalar, len); diff --git a/t/35huge_mode.t b/t/35huge_mode.t index 1ccb334..059d781 100644 --- a/t/35huge_mode.t +++ b/t/35huge_mode.t @@ -29,23 +29,22 @@ my $benign_xml = <<'EOF'; EOF my $evil_xml = <<'EOF'; -<?xml version="1.0"?> -<!DOCTYPE lolz [ - <!ENTITY lol "lol"> - <!ENTITY lol1 "&lol;&lol;"> - <!ENTITY lol2 "&lol1;&lol1;"> - <!ENTITY lol3 "&lol2;&lol2;"> - <!ENTITY lol4 "&lol3;&lol3;"> - <!ENTITY lol5 "&lol4;&lol4;"> - <!ENTITY lol6 "&lol5;&lol5;"> - <!ENTITY lol7 "&lol6;&lol6;"> - <!ENTITY lol8 "&lol7;&lol7;"> - <!ENTITY lol9 "&lol8;&lol8;"> +<!DOCTYPE root [ + <!ENTITY ha "Ha !"> + <!ENTITY ha2 "&ha; &ha;"> +EOF + +foreach my $i (2 .. 47) +{ + $evil_xml .= sprintf(qq# <!ENTITY ha%d "&ha%d; &ha%d;">\n#, $i+1, $i, $i); +} + +$evil_xml .= <<'EOF'; ]> -<lolz>&lol9;</lolz> +<root>&ha48;</root> EOF -my($parser, $doc); +my ($parser, $doc, $err); $parser = XML::LibXML->new; #$parser->set_option(huge => 0); @@ -54,18 +53,22 @@ ok(!$parser->get_option('huge'), "huge mode disabled by default"); $doc = eval { $parser->parse_string($evil_xml); }; +$err = $@; + # TEST -isnt("$@", "", "exception thrown during parse"); +isnt("$err", "", "exception thrown during parse"); # TEST -like($@, qr/entity.*loop/si, "exception refers to entity reference loop"); +like($err, qr/entity/si, "exception refers to entity maximum loop (libxml2 <= 2.10) or depth (>= 2.11)"); $parser = XML::LibXML->new; $doc = eval { $parser->parse_string($benign_xml); }; +$err = $@; + # TEST -is("$@", "", "no exception thrown during parse"); +is("$err", "", "no exception thrown during parse"); my $body = $doc->findvalue( '/lolz' ); # TEST diff --git a/t/namespace-magic-scalar-rt144415.t b/t/namespace-magic-scalar-rt144415.t new file mode 100755 index 0000000..27cf0f0 --- /dev/null +++ b/t/namespace-magic-scalar-rt144415.t @@ -0,0 +1,35 @@ +use strict; +use warnings; + +use Test::More tests => 3; + +use XML::LibXML; + +sub test_one { + local $Test::Builder::Level = $Test::Builder::Level + 1; + + my ($ns, $name) = @_; + my $doc = XML::LibXML::Document->new; + my $foo = $doc->createElement('foo'); + $foo->appendChild( + # we need to access the aliased SV directly, assigning it to a + # different variable hides the problem + $doc->createElementNS( $$ns, 'bar' ), + ); + + return is( + $foo->toString, + qq[<foo><bar xmlns="$$ns"/></foo>], + "$name: namespace should be in force", + ); +} + +my $ns1 = \'urn:a'; +my $ns2 = \substr($$ns1, 0); + +# TEST +test_one $ns1, 'plain scalar'; +# TEST +test_one $ns2, 'magic scalar'; +# TEST +test_one \"$$ns2", 'copy of magic scalar'; |