diff options
Diffstat (limited to 'ext/simplexml/simplexml.c')
-rw-r--r-- | ext/simplexml/simplexml.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index f84e1e014d..a915862ec4 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1269,6 +1269,9 @@ SXE_METHOD(xpath) } if (!sxe->node) { php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement((xmlDocPtr) sxe->document->ptr), NULL TSRMLS_CC); + if (!sxe->node) { + RETURN_FALSE; + } } nodeptr = php_sxe_get_first_node(sxe, sxe->node->node TSRMLS_CC); @@ -1533,15 +1536,18 @@ SXE_METHOD(getDocNamespaces) return; } - array_init(return_value); - sxe = php_sxe_fetch_object(getThis() TSRMLS_CC); if(from_root){ node = xmlDocGetRootElement((xmlDocPtr)sxe->document->ptr); }else{ GET_NODE(sxe, node); } - + + if (node == NULL) { + RETURN_FALSE; + } + + array_init(return_value); sxe_add_registered_namespaces(sxe, node, recursive, return_value TSRMLS_CC); } /* }}} */ |