summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnout Boks <arnoutboks@gmail.com>2017-01-02 11:47:49 +0100
committerJoe Watkins <krakjoe@php.net>2017-01-02 11:56:37 +0000
commita8955926c2da6cb225edb92236e04ff9eb7cbcfa (patch)
tree07d225d3cd09b49b066a4c1002a03bfb247470e9
parent19c4a2ef192d39316bf472d91cbd77f637a79a23 (diff)
downloadphp-git-a8955926c2da6cb225edb92236e04ff9eb7cbcfa.tar.gz
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.
-rw-r--r--ext/dom/php_dom.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 9984356c30..fa2133bd0d 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -1345,7 +1345,7 @@ xmlNode *dom_get_elements_by_tag_name_ns_raw(xmlNodePtr nodep, char *ns, char *l
while (nodep != NULL && (*cur <= index || index == -1)) {
if (nodep->type == XML_ELEMENT_NODE) {
if (xmlStrEqual(nodep->name, (xmlChar *)local) || xmlStrEqual((xmlChar *)"*", (xmlChar *)local)) {
- if (ns == NULL || (nodep->ns != NULL && (xmlStrEqual(nodep->ns->href, (xmlChar *)ns) || xmlStrEqual((xmlChar *)"*", (xmlChar *)ns)))) {
+ if (ns == NULL || (!strcmp(ns, "") && nodep->ns == NULL) || (nodep->ns != NULL && (xmlStrEqual(nodep->ns->href, (xmlChar *)ns) || xmlStrEqual((xmlChar *)"*", (xmlChar *)ns)))) {
if (*cur == index) {
ret = nodep;
break;