summaryrefslogtreecommitdiff
path: root/ext/simplexml/simplexml.c
diff options
context:
space:
mode:
authorChristian Stocker <chregu@php.net>2011-09-01 13:42:45 +0000
committerChristian Stocker <chregu@php.net>2011-09-01 13:42:45 +0000
commite1813b69c52fbe37834771bcab91eebe3a43738c (patch)
tree79dc3ff0449dd5f1bdac2396d5984528ca6c2dd5 /ext/simplexml/simplexml.c
parent3c15d50c80c2e7ee3e8d316372923a06e7223fe1 (diff)
downloadphp-git-e1813b69c52fbe37834771bcab91eebe3a43738c.tar.gz
Merge from Trunk
simplexml->query returns empty array if no nodes were found and false if libxml thinks the xpath-expression was invalid. Behaves now the same like DomXPath and fixes Bug #48601 Adjusted a test to reflect that change
Diffstat (limited to 'ext/simplexml/simplexml.c')
-rw-r--r--ext/simplexml/simplexml.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 9bb9af1a85..c2697ba170 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -1264,8 +1264,9 @@ SXE_METHOD(xpath)
result = retval->nodesetval;
+ array_init(return_value);
+
if (result != NULL) {
- array_init(return_value);
for (i = 0; i < result->nodeNr; ++i) {
nodeptr = result->nodeTab[i];
if (nodeptr->type == XML_TEXT_NODE || nodeptr->type == XML_ELEMENT_NODE || nodeptr->type == XML_ATTRIBUTE_NODE) {
@@ -1286,8 +1287,6 @@ SXE_METHOD(xpath)
add_next_index_zval(return_value, value);
}
}
- } else {
- RETVAL_FALSE;
}
xmlXPathFreeObject(retval);