]> granicus.if.org Git - php/commitdiff
MFH 1.174 (Make domxml_xslt_process() working again.)
authorChristian Stocker <chregu@php.net>
Mon, 19 Aug 2002 07:27:33 +0000 (07:27 +0000)
committerChristian Stocker <chregu@php.net>
Mon, 19 Aug 2002 07:27:33 +0000 (07:27 +0000)
MDH 1.187 (DOMXML crash on removing previously created attributes)

ext/domxml/php_domxml.c

index c0d0c20307276fae17f0f8656ce12c97f6a71ef1..9ec097e4ed55b5c35c8144743b43da94c0f5a074 100644 (file)
@@ -589,6 +589,16 @@ static void php_free_xml_node(zend_rsrc_list_entry *rsrc TSRMLS_DC)
 
 }
 
+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)
@@ -1257,7 +1267,7 @@ PHP_MINIT_FUNCTION(domxml)
         */
        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, "domnode", 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);
@@ -4277,7 +4287,7 @@ PHP_FUNCTION(domxml_xslt_process)
        - test other stuff
        - check xsltsp->errors ???
 */
-       zval *rv, *idxsl, *idxml, *idparams = NULL;
+       zval *rv = NULL, *idxsl, *idxml, *idparams = NULL;
        zend_bool xpath_params = 0;
        xsltStylesheetPtr xsltstp;
        xmlDocPtr xmldocp;