From: Christian Stocker Date: Sat, 17 Aug 2002 11:47:21 +0000 (+0000) Subject: More W3C conformance stuff (they returned all false before..) X-Git-Tag: RELEASE_0_91~418 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6cbb3506075b3c8039a560c827aa20f11011b3b6;p=php More W3C conformance stuff (they returned all false before..) - DomNode->attributes() returns NULL, if not found. - DomNode->first_child() returns NULL, if not found - DomNode->last_child() returns NULL, if not found. - DomNode->namespace_uri() returns NULL, if not found. --- diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c index a10561d5d8..369f2dc011 100644 --- a/ext/domxml/php_domxml.c +++ b/ext/domxml/php_domxml.c @@ -2073,7 +2073,7 @@ PHP_FUNCTION(domxml_node_first_child) first = nodep->children; if (!first) { - RETURN_FALSE; + return; } DOMXML_RET_OBJ(rv, first, &ret); @@ -2094,7 +2094,7 @@ PHP_FUNCTION(domxml_node_last_child) last = nodep->last; if (!last) { - RETURN_FALSE; + return; } DOMXML_RET_OBJ(rv, last, &ret); @@ -2247,7 +2247,8 @@ PHP_FUNCTION(domxml_node_namespace_uri) ns = nodep->ns; if (!ns) { - RETURN_EMPTY_STRING(); + /* return NULL if no ns is given...*/ + return; } if (ns->href) { @@ -2565,17 +2566,22 @@ PHP_FUNCTION(domxml_node_attributes) { zval *id, *attrs; xmlNode *nodep; + int ret; #ifdef oldstyle_for_libxml_1_8_7 xmlAttr *attr; #endif DOMXML_PARAM_NONE(nodep, id, le_domxmlnodep); - - if (node_attributes(&attrs, nodep TSRMLS_CC) < 0) + ret = node_attributes(&attrs, nodep TSRMLS_CC); + if ( ret == -1) { RETURN_FALSE; + } - *return_value = *attrs; - FREE_ZVAL(attrs); + if ( ret > -1) { + *return_value = *attrs; + FREE_ZVAL(attrs); + } + #ifdef oldstyle_for_libxml_1_8_7 attr = nodep->properties; @@ -4532,7 +4538,7 @@ static int node_attributes(zval **attributes, xmlNode *nodep TSRMLS_DC) return -1; attr = nodep->properties; if (!attr) - return -1; + return -2; /* create an php array for the children */ MAKE_STD_ZVAL(*attributes);