]> granicus.if.org Git - php/commitdiff
Fixed test 008
authorIlia Alshanetsky <iliaa@php.net>
Tue, 7 Jun 2011 01:40:54 +0000 (01:40 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 7 Jun 2011 01:40:54 +0000 (01:40 +0000)
ext/simplexml/simplexml.c

index 1d74853cd9c830da923ae3eee78e2e0f72211e44..2ec0ca4ab8ae146fe73046ab1c98d5abe5e72f7d 100644 (file)
@@ -1294,9 +1294,8 @@ 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) {
@@ -1317,6 +1316,8 @@ SXE_METHOD(xpath)
                                add_next_index_zval(return_value, value);
                        }
                }
+       } else {
+               RETVAL_FALSE;
        }
 
        xmlXPathFreeObject(retval);