rrichards Wed Feb 18 17:42:31 2004 EDT Modified files: /php-src/ext/dom xpath.c Log: always return domnodelist unless error http://cvs.php.net/diff.php/php-src/ext/dom/xpath.c?r1=1.17&r2=1.18&ty=u Index: php-src/ext/dom/xpath.c diff -u php-src/ext/dom/xpath.c:1.17 php-src/ext/dom/xpath.c:1.18 --- php-src/ext/dom/xpath.c:1.17 Tue Feb 17 06:13:47 2004 +++ php-src/ext/dom/xpath.c Wed Feb 18 17:42:30 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xpath.c,v 1.17 2004/02/17 11:13:47 rrichards Exp $ */ +/* $Id: xpath.c,v 1.18 2004/02/18 22:42:30 rrichards Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -205,47 +205,43 @@ } + MAKE_STD_ZVAL(retval); + array_init(retval); + if (xpathobjp->type == XPATH_NODESET) { int i; xmlNodeSetPtr nodesetp; - if (NULL == (nodesetp = xpathobjp->nodesetval)) { - xmlXPathFreeObject (xpathobjp); - RETURN_FALSE; - } - - MAKE_STD_ZVAL(retval); - array_init(retval); + if (NULL != (nodesetp = xpathobjp->nodesetval)) { - for (i = 0; i < nodesetp->nodeNr; i++) { - xmlNodePtr node = nodesetp->nodeTab[i]; - zval *child; - - MAKE_STD_ZVAL(child); - - if (node->type == XML_NAMESPACE_DECL) { - xmlNsPtr curns; - xmlNodePtr nsparent; - - nsparent = node->_private; - curns = xmlNewNs(NULL, node->name, NULL); - if (node->children) { - curns->prefix = xmlStrdup((char *) node->children); - } - if (node->children) { - node = xmlNewDocNode(docp, NULL, (char *) node->children, node->name); - } else { - node = xmlNewDocNode(docp, NULL, "xmlns", node->name); + for (i = 0; i < nodesetp->nodeNr; i++) { + xmlNodePtr node = nodesetp->nodeTab[i]; + zval *child; + + MAKE_STD_ZVAL(child); + + if (node->type == XML_NAMESPACE_DECL) { + xmlNsPtr curns; + xmlNodePtr nsparent; + + nsparent = node->_private; + curns = xmlNewNs(NULL, node->name, NULL); + if (node->children) { + curns->prefix = xmlStrdup((char *) node->children); + } + if (node->children) { + node = xmlNewDocNode(docp, NULL, (char *) node->children, node->name); + } else { + node = xmlNewDocNode(docp, NULL, "xmlns", node->name); + } + node->type = XML_NAMESPACE_DECL; + node->parent = nsparent; + node->ns = curns; } - node->type = XML_NAMESPACE_DECL; - node->parent = nsparent; - node->ns = curns; + child = php_dom_create_object(node, &ret, NULL, child, intern TSRMLS_CC); + add_next_index_zval(retval, child); } - child = php_dom_create_object(node, &ret, NULL, child, intern TSRMLS_CC); - add_next_index_zval(retval, child); } - } else { - retval = NULL; } php_dom_create_interator(return_value, DOM_NODELIST TSRMLS_CC);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php