Skip to content

Commit 0f86f73

Browse files
committed
Use match any for ns too (note: contains bugfix for which I'll create PR)
1 parent d8aa3f9 commit 0f86f73

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ext/dom/php_dom.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,12 +1227,13 @@ bool dom_has_feature(zend_string *feature, zend_string *version)
12271227
xmlNode *dom_get_elements_by_tag_name_ns_raw(xmlNodePtr nodep, char *ns, char *local, int *cur, int index) /* {{{ */
12281228
{
12291229
xmlNodePtr ret = NULL;
1230-
bool match_any = local[0] == '*' && local[1] == '\0';
1230+
bool local_match_any = local[0] == '*' && local[1] == '\0';
1231+
bool ns_match_any = ns == NULL || (ns[0] == '*' && ns[1] == '\0');
12311232

12321233
while (nodep != NULL && (*cur <= index || index == -1)) {
12331234
if (nodep->type == XML_ELEMENT_NODE) {
1234-
if (match_any || xmlStrEqual(nodep->name, (xmlChar *)local)) {
1235-
if (ns == NULL || (ns[0] == '\0' && nodep->ns == NULL) || (nodep->ns != NULL && (xmlStrEqual(nodep->ns->href, (xmlChar *)ns) || xmlStrEqual((xmlChar *)"*", (xmlChar *)ns)))) {
1235+
if (local_match_any || xmlStrEqual(nodep->name, (xmlChar *)local)) {
1236+
if (ns_match_any || (ns[0] == '\0' && nodep->ns == NULL) || (nodep->ns != NULL && xmlStrEqual(nodep->ns->href, (xmlChar *)ns))) {
12361237
if (*cur == index) {
12371238
ret = nodep;
12381239
break;

0 commit comments

Comments
 (0)