diff options
Diffstat (limited to 'ext/dom/node.c')
| -rw-r--r-- | ext/dom/node.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/dom/node.c b/ext/dom/node.c index d5cb048537..e95fa2c9d1 100644 --- a/ext/dom/node.c +++ b/ext/dom/node.c @@ -1586,8 +1586,11 @@ PHP_FUNCTION(dom_node_is_default_namespace) } DOM_GET_OBJ(nodep, id, xmlNodePtr, intern); + if (nodep->type == XML_DOCUMENT_NODE || nodep->type == XML_HTML_DOCUMENT_NODE) { + nodep = xmlDocGetRootElement((xmlDocPtr) nodep); + } - if (uri_len > 0) { + if (nodep && uri_len > 0) { nsptr = xmlSearchNs(nodep->doc, nodep, NULL); if (nsptr && xmlStrEqual(nsptr->href, uri)) { RETURN_TRUE; @@ -1617,6 +1620,12 @@ PHP_FUNCTION(dom_node_lookup_namespace_uri) } DOM_GET_OBJ(nodep, id, xmlNodePtr, intern); + if (nodep->type == XML_DOCUMENT_NODE || nodep->type == XML_HTML_DOCUMENT_NODE) { + nodep = xmlDocGetRootElement((xmlDocPtr) nodep); + if (nodep == NULL) { + RETURN_NULL(); + } + } nsptr = xmlSearchNs(nodep->doc, nodep, prefix); if (nsptr && nsptr->href != NULL) { |
