chregu Mon Jan 6 03:47:35 2003 EDT Modified files: /php4/ext/domxml php_domxml.c Log: @- Added domxml_node_get_path() (Lukas Schröder) - Fixed segfault, when trying to add a node to itself. Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.228 php4/ext/domxml/php_domxml.c:1.229 --- php4/ext/domxml/php_domxml.c:1.228 Tue Dec 31 11:06:31 2002 +++ php4/ext/domxml/php_domxml.c Mon Jan 6 03:47:35 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_domxml.c,v 1.228 2002/12/31 16:06:31 sebastian Exp $ */ +/* $Id: php_domxml.c,v 1.229 2003/01/06 08:47:35 chregu Exp $ */ /* TODO * - Support Notation Nodes @@ -420,6 +420,7 @@ PHP_FALIAS(get_content, domxml_node_get_content, NULL) PHP_FALIAS(text_concat, domxml_node_text_concat, NULL) PHP_FALIAS(set_name, domxml_node_set_name, NULL) + PHP_FALIAS(get_path, domxml_node_get_path, + NULL) PHP_FALIAS(is_blank_node, domxml_is_blank_node, NULL) PHP_FALIAS(dump_node, domxml_dump_node, NULL) {NULL, NULL, NULL} @@ -2190,6 +2191,25 @@ } /* }}} */ +/* {{{ proto string domxml_node_get_path(void) + Returns the path of the node in the document */ +PHP_FUNCTION(domxml_node_get_path) +{ + zval *id; + xmlNodePtr nodep; + xmlChar *path; + + DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep); + + DOMXML_NO_ARGS(); + + path = xmlGetNodePath(nodep); + if (!path) { + RETURN_FALSE; + } + RETVAL_STRING((char *)path, 1); + xmlFree(path); +} /* {{{ proto object domxml_node_parent(void) Returns parent of node */ @@ -2300,6 +2320,12 @@ if (child->type == XML_ATTRIBUTE_NODE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't append attribute node"); + RETURN_FALSE; + } + + /* XXX:ls */ + if (child == parent) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't append node to +itself"); RETURN_FALSE; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php