summaryrefslogtreecommitdiff
path: root/ext/dom/node.c
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2007-05-04 19:30:59 +0000
committerRob Richards <rrichards@php.net>2007-05-04 19:30:59 +0000
commit24434e7ba23ba5019957a19dacf01a72d30c9a41 (patch)
treeb888cc51e00b11373eeb3a2afb2b160ed32d19ef /ext/dom/node.c
parent567c9daeaeb4b6e059e88ca930d6f99d28c0739e (diff)
downloadphp-git-24434e7ba23ba5019957a19dacf01a72d30c9a41.tar.gz
fix bug #41257 (lookupNamespaceURI does not work as expected)
fix related issue in isDefaultNamespace add test reconcile namespaces when setting attribute in a new namespace
Diffstat (limited to 'ext/dom/node.c')
-rw-r--r--ext/dom/node.c11
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) {