Skip to content

Commit e56904a

Browse files
authored
Disable old libxml2 hack if the version does not suffer from the bug (#11379)
This bug is ancient, we'll keep the code but version check if with an ifdef. This should also save some cycles.
1 parent a02f7f2 commit e56904a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ext/dom/documentfragment.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ PHP_METHOD(DOMDocumentFragment, __construct)
5757
}
5858
/* }}} end DOMDocumentFragment::__construct */
5959

60+
#if LIBXML_VERSION <= 20614
6061
/* php_dom_xmlSetTreeDoc is a custom implementation of xmlSetTreeDoc
6162
needed for hack in appendXML due to libxml bug - no need to share this function */
6263
static void php_dom_xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) /* {{{ */
@@ -90,6 +91,7 @@ static void php_dom_xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) /* {{{ */
9091
}
9192
}
9293
/* }}} */
94+
#endif
9395

9496
/* {{{ */
9597
PHP_METHOD(DOMDocumentFragment, appendXML) {
@@ -118,10 +120,11 @@ PHP_METHOD(DOMDocumentFragment, appendXML) {
118120
if (err != 0) {
119121
RETURN_FALSE;
120122
}
121-
/* Following needed due to bug in libxml2 <= 2.6.14
122-
ifdef after next libxml release as bug is fixed in their cvs */
123+
#if LIBXML_VERSION <= 20614
124+
/* Following needed due to bug in libxml2 <= 2.6.14 */
123125
php_dom_xmlSetTreeDoc(lst, nodep->doc);
124126
/* End stupid hack */
127+
#endif
125128

126129
xmlAddChildList(nodep,lst);
127130
}

0 commit comments

Comments
 (0)