mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Two tiny ext/dom cleanups (#11541)
* Remove obsolete workaround code This code was for libxml2 <= 2.6.14. PHP requires at least libxml2 2.9.0. * Use an inline check instead of calling into the library for an empty string check
This commit is contained in:
parent
db2ac3a656
commit
21c1fb6a67
2 changed files with 1 additions and 42 deletions
|
@ -57,42 +57,6 @@ PHP_METHOD(DOMDocumentFragment, __construct)
|
||||||
}
|
}
|
||||||
/* }}} end DOMDocumentFragment::__construct */
|
/* }}} end DOMDocumentFragment::__construct */
|
||||||
|
|
||||||
#if LIBXML_VERSION <= 20614
|
|
||||||
/* php_dom_xmlSetTreeDoc is a custom implementation of xmlSetTreeDoc
|
|
||||||
needed for hack in appendXML due to libxml bug - no need to share this function */
|
|
||||||
static void php_dom_xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) /* {{{ */
|
|
||||||
{
|
|
||||||
xmlAttrPtr prop;
|
|
||||||
xmlNodePtr cur;
|
|
||||||
|
|
||||||
if (tree) {
|
|
||||||
if(tree->type == XML_ELEMENT_NODE) {
|
|
||||||
prop = tree->properties;
|
|
||||||
while (prop != NULL) {
|
|
||||||
prop->doc = doc;
|
|
||||||
if (prop->children) {
|
|
||||||
cur = prop->children;
|
|
||||||
while (cur != NULL) {
|
|
||||||
php_dom_xmlSetTreeDoc(cur, doc);
|
|
||||||
cur = cur->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
prop = prop->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tree->children != NULL) {
|
|
||||||
cur = tree->children;
|
|
||||||
while (cur != NULL) {
|
|
||||||
php_dom_xmlSetTreeDoc(cur, doc);
|
|
||||||
cur = cur->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tree->doc = doc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* }}} */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* {{{ */
|
/* {{{ */
|
||||||
PHP_METHOD(DOMDocumentFragment, appendXML) {
|
PHP_METHOD(DOMDocumentFragment, appendXML) {
|
||||||
zval *id;
|
zval *id;
|
||||||
|
@ -120,11 +84,6 @@ PHP_METHOD(DOMDocumentFragment, appendXML) {
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
#if LIBXML_VERSION <= 20614
|
|
||||||
/* Following needed due to bug in libxml2 <= 2.6.14 */
|
|
||||||
php_dom_xmlSetTreeDoc(lst, nodep->doc);
|
|
||||||
/* End stupid hack */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
xmlAddChildList(nodep,lst);
|
xmlAddChildList(nodep,lst);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1636,7 +1636,7 @@ xmlNsPtr dom_get_nsdecl(xmlNode *node, xmlChar *localName) {
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (localName == NULL || xmlStrEqual(localName, (xmlChar *)"")) {
|
if (localName == NULL || localName[0] == '\0') {
|
||||||
cur = node->nsDef;
|
cur = node->nsDef;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
if (cur->prefix == NULL && cur->href != NULL) {
|
if (cur->prefix == NULL && cur->href != NULL) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue