Fixed bug #26743 (getElementsByTagName doesn't work properly)

This commit is contained in:
Rob Richards 2003-12-29 16:44:47 +00:00
parent d001928aa2
commit 66c68da22b
2 changed files with 8 additions and 0 deletions

View File

@ -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);
}

View File

@ -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);
}