From: Christian Stocker Date: Wed, 14 Aug 2002 07:29:46 +0000 (+0000) Subject: @ - DomNode->child_nodes() returns empty array instead of false, if no X-Git-Tag: php-4.3.0dev_zend2_alpha3~70 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=43bdd6ed73dba6eddc49ddf38218e9e3e59ea503;p=php @ - DomNode->child_nodes() returns empty array instead of false, if no @ - child nodes are found (chregu) --- diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c index 3e6e4a0085..fde6fdfd0a 100644 --- a/ext/domxml/php_domxml.c +++ b/ext/domxml/php_domxml.c @@ -2258,19 +2258,18 @@ PHP_FUNCTION(domxml_node_children) last = ((xmlDoc *) nodep)->children; else last = nodep->children; - if (!last) { - RETURN_FALSE; - } if (array_init(return_value) == FAILURE) { RETURN_FALSE; } - - while (last) { - zval *child; - child = php_domobject_new(last, &ret, NULL TSRMLS_CC); - add_next_index_zval(return_value, child); - last = last->next; + + if (last) { + while (last) { + zval *child; + child = php_domobject_new(last, &ret, NULL TSRMLS_CC); + add_next_index_zval(return_value, child); + last = last->next; + } } } /* }}} */