summaryrefslogtreecommitdiff
path: root/ext/domxml/php_domxml.c
diff options
context:
space:
mode:
authorChristian Stocker <chregu@php.net>2002-08-17 11:47:21 +0000
committerChristian Stocker <chregu@php.net>2002-08-17 11:47:21 +0000
commit6cbb3506075b3c8039a560c827aa20f11011b3b6 (patch)
treee95fad10436d67d68fd55af09f68ad32bad706f3 /ext/domxml/php_domxml.c
parentecaa0a091a7402f90fa0225cfa7bdd04589215d1 (diff)
downloadphp-git-6cbb3506075b3c8039a560c827aa20f11011b3b6.tar.gz
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.
Diffstat (limited to 'ext/domxml/php_domxml.c')
-rw-r--r--ext/domxml/php_domxml.c22
1 files changed, 14 insertions, 8 deletions
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);