Hi all,

I'm forwarding this from <https://bugs.php.net/78299>, because I think
it is a libxml2 issue.  Consider:


doc1:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [<!ENTITY lang "lang=en">]>
<root href="index.php?&lang;"/>

doc2:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [<!ENTITY lang "lang=en">]>
<root/>


Both documents are parsed, and the documentElement of doc1 is imported
into doc2 (xmlDocCopyNode), and appended as child of the root element.
When reading the value of the href attribute of the newly inserted
element (xmlNodeListGetString), the entity reference is missing:

index.php?

The following patch solves this issue, but I have no idea whether it is
the proper patch.


 tree.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tree.c b/tree.c
index c707f59..80de6d8 100644
--- a/tree.c
+++ b/tree.c
@@ -1740,6 +1740,8 @@ xmlNodeListGetString(xmlDocPtr doc, const xmlNode
*list, int inLine)
                     if (buffer != NULL) {
                         ret = xmlStrcat(ret, buffer);
                         xmlFree(buffer);
+                    } else if (ent->content != NULL) {
+                        ret = xmlStrcat(ret, ent->content);
                     }
                 } else {
                     ret = xmlStrcat(ret, node->content);


Christoph
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
https://mail.gnome.org/mailman/listinfo/xml

Reply via email to