Skip to content

Commit a895592

Browse files
abokskrakjoe
authored andcommitted
Fixed #67474 (getElementsByTagNameNS and default namespace)
This bug was caused by the fact that dom_get_elements_by_tag_name_ns_raw uses an empty string to filter on the default namespace (as NULL means 'no filter'), whereas in the node itself the default namespace is signalled by nodep->ns being null.
1 parent 19c4a2e commit a895592

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/dom/php_dom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ xmlNode *dom_get_elements_by_tag_name_ns_raw(xmlNodePtr nodep, char *ns, char *l
13451345
while (nodep != NULL && (*cur <= index || index == -1)) {
13461346
if (nodep->type == XML_ELEMENT_NODE) {
13471347
if (xmlStrEqual(nodep->name, (xmlChar *)local) || xmlStrEqual((xmlChar *)"*", (xmlChar *)local)) {
1348-
if (ns == NULL || (nodep->ns != NULL && (xmlStrEqual(nodep->ns->href, (xmlChar *)ns) || xmlStrEqual((xmlChar *)"*", (xmlChar *)ns)))) {
1348+
if (ns == NULL || (!strcmp(ns, "") && nodep->ns == NULL) || (nodep->ns != NULL && (xmlStrEqual(nodep->ns->href, (xmlChar *)ns) || xmlStrEqual((xmlChar *)"*", (xmlChar *)ns)))) {
13491349
if (*cur == index) {
13501350
ret = nodep;
13511351
break;

0 commit comments

Comments
 (0)