summaryrefslogtreecommitdiff
path: root/ext/dom/xpath.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dom/xpath.c')
-rw-r--r--ext/dom/xpath.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c
index 31e4dc98b4..f0b908ccf3 100644
--- a/ext/dom/xpath.c
+++ b/ext/dom/xpath.c
@@ -432,8 +432,9 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
int i;
xmlNodeSetPtr nodesetp;
- array_init(&retval);
if (xpathobjp->type == XPATH_NODESET && NULL != (nodesetp = xpathobjp->nodesetval) && nodesetp->nodeNr) {
+
+ array_init(&retval);
for (i = 0; i < nodesetp->nodeNr; i++) {
xmlNodePtr node = nodesetp->nodeTab[i];
zval child;
@@ -459,6 +460,8 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
php_dom_create_object(node, &child, &intern->dom);
add_next_index_zval(&retval, &child);
}
+ } else {
+ ZVAL_EMPTY_ARRAY(&retval);
}
php_dom_create_interator(return_value, DOM_NODELIST);
nodeobj = Z_DOMOBJ_P(return_value);