summaryrefslogtreecommitdiff
path: root/ext/dom/php_dom.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dom/php_dom.c')
-rw-r--r--ext/dom/php_dom.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 9dcb79e398..618b2fe7d0 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -1241,9 +1241,13 @@ int dom_hierarchy(xmlNodePtr parent, xmlNodePtr child)
{
xmlNodePtr nodep;
- if (parent == NULL || child == NULL || child->doc != parent->doc) {
- return SUCCESS;
- }
+ if (parent == NULL || child == NULL || child->doc != parent->doc) {
+ return SUCCESS;
+ }
+
+ if (child->type == XML_DOCUMENT_NODE) {
+ return FAILURE;
+ }
nodep = parent;