cvs: php4 /ext/domxml php_domxml.c
| From: | Christian Stocker | Date: | Wed, 14 Aug 2002 08:27:36 +0000 |
| Subject: | cvs: php4 /ext/domxml php_domxml.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-13343@lists.php.net to get a copy of this message | ||
chregu Wed Aug 14 04:27:36 2002 EDT
Modified files:
/php4/ext/domxml php_domxml.c
Log:
fix for bug #18395 (DOMXML crash on removing previously created attributes)
Index: php4/ext/domxml/php_domxml.c
diff -u php4/ext/domxml/php_domxml.c:1.186 php4/ext/domxml/php_domxml.c:1.187
--- php4/ext/domxml/php_domxml.c:1.186 Wed Aug 14 03:29:46 2002
+++ php4/ext/domxml/php_domxml.c Wed Aug 14 04:27:36 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_domxml.c,v 1.186 2002/08/14 07:29:46 chregu Exp $ */
+/* $Id: php_domxml.c,v 1.187 2002/08/14 08:27:36 chregu Exp $ */
/* TODO
* - Support Notation Nodes
@@ -650,6 +650,17 @@
}
+static void php_free_xml_attr(zend_rsrc_list_entry *rsrc TSRMLS_DC)
+{
+ xmlNodePtr node = (xmlNodePtr) rsrc->ptr;
+ if (node->parent == NULL) {
+ node_wrapper_dtor(node);
+ xmlFreeProp((xmlAttrPtr) node);
+ } else {
+ node_wrapper_dtor(node);
+ }
+}
+
#if defined(LIBXML_XPATH_ENABLED)
static void php_free_xpath_context(zend_rsrc_list_entry *rsrc TSRMLS_DC)
@@ -1525,7 +1536,7 @@
*/
le_domxmlnodep = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domnode",
module_number);
le_domxmlcommentp = zend_register_list_destructors_ex(php_free_xml_node, NULL,
"domcomment", module_number);
- le_domxmlattrp = zend_register_list_destructors_ex(php_free_xml_node, NULL,
"domattribute", module_number);
+ le_domxmlattrp = zend_register_list_destructors_ex(php_free_xml_attr, NULL,
"domattribute", module_number);
le_domxmltextp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domtext",
module_number);
le_domxmlelementp = zend_register_list_destructors_ex(php_free_xml_node, NULL,
"domelement", module_number);
le_domxmldtdp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domdtd",
module_number);