mirror of
https://github.com/php/php-src.git
synced 2024-12-12 11:23:53 +08:00
Fixed bug #26743 (getElementsByTagName doesn't work properly)
This commit is contained in:
parent
d001928aa2
commit
66c68da22b
@ -207,6 +207,8 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC)
|
||||
basenode = dom_object_get_node(objmap->baseobj);
|
||||
if (basenode && (basenode->type == XML_DOCUMENT_NODE || basenode->type == XML_HTML_DOCUMENT_NODE)) {
|
||||
basenode = xmlDocGetRootElement((xmlDoc *) basenode);
|
||||
} else {
|
||||
basenode = basenode->children;
|
||||
}
|
||||
curnode = dom_get_elements_by_tag_name_ns_raw(basenode, objmap->ns, objmap->local, &previndex, iter->index);
|
||||
}
|
||||
@ -264,6 +266,8 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object TS
|
||||
} else {
|
||||
if (nodep->type == XML_DOCUMENT_NODE || nodep->type == XML_HTML_DOCUMENT_NODE) {
|
||||
nodep = xmlDocGetRootElement((xmlDoc *) nodep);
|
||||
} else {
|
||||
nodep = nodep->children;
|
||||
}
|
||||
curnode = dom_get_elements_by_tag_name_ns_raw(nodep, objmap->ns, objmap->local, &curindex, 0);
|
||||
}
|
||||
|
@ -71,6 +71,8 @@ int dom_nodelist_length_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
} else {
|
||||
if (nodep->type == XML_DOCUMENT_NODE || nodep->type == XML_HTML_DOCUMENT_NODE) {
|
||||
nodep = xmlDocGetRootElement((xmlDoc *) nodep);
|
||||
} else {
|
||||
nodep = nodep->children;
|
||||
}
|
||||
curnode = dom_get_elements_by_tag_name_ns_raw(nodep, objmap->ns, objmap->local, &count, -1);
|
||||
}
|
||||
@ -129,6 +131,8 @@ PHP_FUNCTION(dom_nodelist_item)
|
||||
} else {
|
||||
if (nodep->type == XML_DOCUMENT_NODE || nodep->type == XML_HTML_DOCUMENT_NODE) {
|
||||
nodep = xmlDocGetRootElement((xmlDoc *) nodep);
|
||||
} else {
|
||||
nodep = nodep->children;
|
||||
}
|
||||
itemnode = dom_get_elements_by_tag_name_ns_raw(nodep, objmap->ns, objmap->local, &count, index);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user