diff options
author | Christian Stocker <chregu@php.net> | 2011-08-31 11:44:22 +0000 |
---|---|---|
committer | Christian Stocker <chregu@php.net> | 2011-08-31 11:44:22 +0000 |
commit | 13fa5542f70d027e8303e5d0c320fe457c5fc7b2 (patch) | |
tree | a5d7db67ea90d3dc62edeea08d3abf53c88e2835 /ext/simplexml/simplexml.c | |
parent | 69c84fde82c01847bb47000f1cb1d6b4965f1601 (diff) | |
download | php-git-13fa5542f70d027e8303e5d0c320fe457c5fc7b2.tar.gz |
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.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index c7bada57c4..d05630c2c9 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1294,8 +1294,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) { @@ -1316,8 +1317,6 @@ SXE_METHOD(xpath) add_next_index_zval(return_value, value); } } - } else { - RETVAL_FALSE; } xmlXPathFreeObject(retval); |