[libxml2] Add the copy of type from original xmlDoc in xmlCopyDoc()



commit 07920b4381873187c02df53fa9b5d44aff3a7041
Author: SVGAnimate <glash gnome gmail com>
Date:   Tue Jan 26 05:42:48 2021 +0000

    Add the copy of type from original xmlDoc in xmlCopyDoc()
    
    A bug related to php DOMDocument:
    
        https://bugs.php.net/bug.php?id=80665
    
    When copy/clone an html document, the xmlDoc->type goes from
    XML_HTML_DOCUMENT_NODE to XML_DOCUMENT_NODE.

 tree.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/tree.c b/tree.c
index 2130d55d..d2347dfd 100644
--- a/tree.c
+++ b/tree.c
@@ -4558,6 +4558,7 @@ xmlCopyDoc(xmlDocPtr doc, int recursive) {
     if (doc == NULL) return(NULL);
     ret = xmlNewDoc(doc->version);
     if (ret == NULL) return(NULL);
+    ret->type = doc->type;
     if (doc->name != NULL)
         ret->name = xmlMemStrdup(doc->name);
     if (doc->encoding != NULL)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]