[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
rrichards Wed Jun 18 13:42:39 2003 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: Fix for bug #24219 segfault during resource destruction Used bug fix to optimize free_doc routine Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.257 php4/ext/domxml/php_domxml.c:1.258 --- php4/ext/domxml/php_domxml.c:1.257 Tue Jun 10 16:03:27 2003 +++ php4/ext/domxml/php_domxml.cWed Jun 18 13:42:39 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.257 2003/06/10 20:03:27 imajes Exp $ */ +/* $Id: php_domxml.c,v 1.258 2003/06/18 17:42:39 rrichards Exp $ */ /* TODO * - Support Notation Nodes @@ -729,7 +729,7 @@ xmlDoc *doc = (xmlDoc *) rsrc-ptr; if (doc) { - node_list_wrapper_dtor(doc-children, 0 TSRMLS_CC); + node_list_wrapper_dtor(doc-children, 1 TSRMLS_CC); node_wrapper_dtor((xmlNodePtr) doc); xmlFreeDoc(doc); } @@ -745,8 +745,8 @@ /* Attribute Nodes ccontain accessible children attr_list_wrapper_dtor(node-properties); */ xmlSetTreeDoc(node, NULL); - node_list_wrapper_dtor((xmlNodePtr) node-properties, 0 TSRMLS_CC); - node_list_wrapper_dtor(node-children, 0 TSRMLS_CC); + node_list_wrapper_dtor((xmlNodePtr) node-properties, 1 TSRMLS_CC); + node_list_wrapper_dtor(node-children, 1 TSRMLS_CC); node_wrapper_dtor(node); xmlFreeNode(node); } else { @@ -759,7 +759,7 @@ xmlNodePtr node = (xmlNodePtr) rsrc-ptr; if (node-parent == NULL) { /* Attribute Nodes contain accessible children */ - node_list_wrapper_dtor(node-children, 0 TSRMLS_CC); + node_list_wrapper_dtor(node-children, 1 TSRMLS_CC); node_wrapper_dtor(node); xmlFreeProp((xmlAttrPtr) node); } else { @@ -4488,10 +4488,10 @@ RETURN_FALSE; } + /* No need to do this as php_free_xml_doc will kill the children node_list_wrapper_dtor(docp-children, 1 TSRMLS_CC); node_list_wrapper_dtor((xmlNodePtr) docp-properties, 1 TSRMLS_CC); - /* Attribute Nodes ccontain accessible children - attr_list_wrapper_dtor(docp-properties); */ + */ node_wrapper_free(docp TSRMLS_CC); RETURN_TRUE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
moriyoshi Thu Jun 5 14:59:55 2003 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: Avoid unnecessary zval separation Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.255 php4/ext/domxml/php_domxml.c:1.256 --- php4/ext/domxml/php_domxml.c:1.255 Mon Jun 2 14:57:59 2003 +++ php4/ext/domxml/php_domxml.cThu Jun 5 14:59:55 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.255 2003/06/02 18:57:59 rrichards Exp $ */ +/* $Id: php_domxml.c,v 1.256 2003/06/05 18:59:55 moriyoshi Exp $ */ /* TODO * - Support Notation Nodes @@ -1090,8 +1090,10 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid argument or parameter array); return NULL; } else { - SEPARATE_ZVAL(value); - convert_to_string_ex(value); + if (Z_TYPE_PP(value) != IS_STRING) { + SEPARATE_ZVAL(value); + convert_to_string(*value); + } expr = Z_STRVAL_PP(value); if (expr) { @@ -5481,8 +5483,10 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid argument or parameter array); return NULL; } else { - SEPARATE_ZVAL(value); - convert_to_string_ex(value); + if (Z_TYPE_PP(value) != IS_STRING) { + SEPARATE_ZVAL(value); + convert_to_string(*value); + } if (!xpath_params) { xpath_expr = php_domxslt_string_to_xpathexpr(Z_STRVAL_PP(value) TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
rrichards Mon Jun 2 14:57:59 2003 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: Fix for 64 bit platforms (by Joe Orton) Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.254 php4/ext/domxml/php_domxml.c:1.255 --- php4/ext/domxml/php_domxml.c:1.254 Tue May 13 10:52:36 2003 +++ php4/ext/domxml/php_domxml.cMon Jun 2 14:57:59 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.254 2003/05/13 14:52:36 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.255 2003/06/02 18:57:59 rrichards Exp $ */ /* TODO * - Support Notation Nodes @@ -866,7 +866,7 @@ MAKE_STD_ZVAL(addr); Z_TYPE_P(addr) = IS_LONG; - Z_LVAL_P(addr) = (int) obj; + Z_LVAL_P(addr) = (long) obj; zend_hash_index_update(Z_OBJPROP_P(wrapper), 0, handle, sizeof(zval *), NULL); zend_hash_index_update(Z_OBJPROP_P(wrapper), 1, addr, sizeof(zval *), NULL); @@ -980,7 +980,7 @@ MAKE_STD_ZVAL(addr); Z_TYPE_P(addr) = IS_LONG; - Z_LVAL_P(addr) = (int) obj; + Z_LVAL_P(addr) = (long) obj; zend_hash_index_update(Z_OBJPROP_P(wrapper), 0, handle, sizeof(zval *), NULL); zend_hash_index_update(Z_OBJPROP_P(wrapper), 1, addr, sizeof(zval *), NULL); @@ -1035,7 +1035,7 @@ MAKE_STD_ZVAL(addr); Z_TYPE_P(addr) = IS_LONG; - Z_LVAL_P(addr) = (int) obj; + Z_LVAL_P(addr) = (long) obj; zend_hash_index_update(Z_OBJPROP_P(wrapper), 0, handle, sizeof(zval *), NULL); zend_hash_index_update(Z_OBJPROP_P(wrapper), 1, addr, sizeof(zval *), NULL); @@ -1151,7 +1151,7 @@ MAKE_STD_ZVAL(addr); Z_TYPE_P(addr) = IS_LONG; - Z_LVAL_P(addr) = (int) obj; + Z_LVAL_P(addr) = (long) obj; zend_hash_index_update(Z_OBJPROP_P(wrapper), 0, handle, sizeof(zval *), NULL); zend_hash_index_update(Z_OBJPROP_P(wrapper), 1, addr, sizeof(zval *), NULL); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c php_domxml.h
chregu Thu Apr 3 05:21:19 2003 EDT Modified files: /php4/ext/domxmlphp_domxml.c php_domxml.h Log: - Added domxml_elem_set_attribute_node() method. (Rob Richards) Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.242 php4/ext/domxml/php_domxml.c:1.243 --- php4/ext/domxml/php_domxml.c:1.242 Wed Apr 2 05:31:33 2003 +++ php4/ext/domxml/php_domxml.cThu Apr 3 05:21:19 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.242 2003/04/02 10:31:33 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.243 2003/04/03 10:21:19 chregu Exp $ */ /* TODO * - Support Notation Nodes @@ -429,9 +429,7 @@ PHP_FALIAS(set_attribute, domxml_elem_set_attribute, NULL) PHP_FALIAS(remove_attribute,domxml_elem_remove_attribute, NULL) PHP_FALIAS(get_attribute_node, domxml_elem_get_attribute_node, NULL) -/* since this function is not implemented, outcomment it for the time beeing PHP_FALIAS(set_attribute_node, domxml_elem_set_attribute_node, NULL) -*/ #if defined(LIBXML_XPATH_ENABLED) PHP_FALIAS(get_elements_by_tagname, domxml_elem_get_elements_by_tagname, NULL) #endif @@ -2849,32 +2847,72 @@ /* {{{ proto bool domxml_elem_set_attribute_node(object attr) Sets value of given attribute */ -/* since this function is not implemented, outcomment it for the time beeing PHP_FUNCTION(domxml_elem_set_attribute_node) { - zval *id, **arg1, *rv = NULL; + zval *id, *node, *rv = NULL; xmlNode *nodep; - xmlAttr *attrp, *newattrp; + xmlAttr *attrp, *newattrp, *existattrp; int ret; - if ((ZEND_NUM_ARGS() == 1) (zend_get_parameters_ex(1, arg1) == FAILURE) { - WRONG_PARAM_COUNT; + DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, o, node) == FAILURE) { + return; } - id = getThis(); - nodep = php_dom_get_object(id, le_domxmlelementp, 0 TSRMLS_CC); - attrp = php_dom_get_object(*arg1, le_domxmlattrp, 0 TSRMLS_CC); + DOMXML_GET_OBJ(attrp, node, le_domxmlnodep); - FIXME: The following line doesn't work - newattrp = xmlCopyProp(nodep, attrp); - if (!newattrp) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, No such attribute '%s', attrp-name); + if (attrp-type != XML_ATTRIBUTE_NODE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Attribute node is required); RETURN_FALSE; } + + existattrp = xmlHasProp(nodep,attrp-name); + if (existattrp != NULL) { + /* We cannot unlink an existing attribute as it may never be freed + Only the content of the text node of an attribute node is transfered over */ + + xmlChar *mem; + xmlNode *first, *firstattrp; + + first = existattrp-children; + firstattrp = attrp-children; + if (mem = xmlNodeGetContent(firstattrp)) { + if (!first) { + xmlNodeSetContent((xmlNode *) existattrp, mem); + } else { + xmlNodeSetContent(first, mem); + } + xmlFree(mem); + newattrp = existattrp; + } else { + RETURN_FALSE; + } + } else { + /* xmlCopyProp does not add the copy to the element node. + It does set the parent of the copy to the element node however */ + newattrp = xmlCopyProp(nodep, attrp); + if (!newattrp) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, No such attribute '%s', attrp-name); + RETURN_FALSE; + } else { + xmlAttr *prop; + prop = nodep-properties; + if (prop == NULL) { + nodep-properties = newattrp; + } else { + while (prop-next != NULL) { + prop = prop-next; + } + prop-next = newattrp; + newattrp-prev = prop; + } + } + } + DOMXML_RET_OBJ(rv, (xmlNodePtr) newattrp, ret); } -*/ /* }}} */ /* {{{ proto string domxml_elem_has_attribute(string attrname) Index: php4/ext/domxml/php_domxml.h diff -u php4/ext/domxml/php_domxml.h:1.75 php4/ext/domxml/php_domxml.h:1.76 --- php4/ext/domxml/php_domxml.h:1.75 Mon Jan 6 04:59:53 2003 +++ php4/ext/domxml/php_domxml.hThu Apr 3 05:21:19 2003 @@ -16,7 +16,7 @@
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
chregu Wed Apr 2 05:31:33 2003 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: Patch for Bug #22774 by Rob Richards Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.241 php4/ext/domxml/php_domxml.c:1.242 --- php4/ext/domxml/php_domxml.c:1.241 Thu Mar 20 04:48:19 2003 +++ php4/ext/domxml/php_domxml.cWed Apr 2 05:31:33 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.241 2003/03/20 09:48:19 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.242 2003/04/02 10:31:33 chregu Exp $ */ /* TODO * - Support Notation Nodes @@ -1478,10 +1478,6 @@ { zend_class_entry ce; - le_domxmldocp = zend_register_list_destructors_ex(php_free_xml_doc, NULL, domdocument, module_number); - /* Freeing the document contains freeing the complete tree. - Therefore nodes, attributes etc. may not be freed seperately. -*/ 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_attr, NULL, domattribute, module_number); @@ -1493,6 +1489,11 @@ le_domxmlpip = zend_register_list_destructors_ex(php_free_xml_node, NULL, dompi, module_number); le_domxmlparserp = zend_register_list_destructors_ex(php_free_xml_parser, NULL, domparser, module_number); le_domxmldoctypep = zend_register_list_destructors_ex(php_free_xml_node, NULL, domdocumenttype, module_number); + le_domxmldocp = zend_register_list_destructors_ex(php_free_xml_doc, NULL, domdocument, module_number); + /* Freeing the document contains freeing the complete tree. + Therefore nodes, attributes etc. may not be freed seperately. + Moved to end of list to support loading via dl() + */ /* Not yet initialized le_*s */ le_domxmlnotationp = -10003; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
chregu Thu Mar 20 04:48:30 2003 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: fix for bug #22786 (Crash when trying to call DomAttribute's set_namespace method) Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.240 php4/ext/domxml/php_domxml.c:1.241 --- php4/ext/domxml/php_domxml.c:1.240 Wed Mar 19 20:27:40 2003 +++ php4/ext/domxml/php_domxml.cThu Mar 20 04:48:19 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.240 2003/03/20 01:27:40 sniper Exp $ */ +/* $Id: php_domxml.c,v 1.241 2003/03/20 09:48:19 chregu Exp $ */ /* TODO * - Support Notation Nodes @@ -3352,7 +3352,11 @@ /* if node is in a document, search for an already existing namespace */ if (nodep-doc != NULL) { - nsptr = xmlSearchNsByHref(nodep-doc, nodep, (xmlChar*) uri); + if (nodep-type == XML_ATTRIBUTE_NODE) { + nsptr = xmlSearchNsByHref(nodep-doc, nodep-parent, (xmlChar*) uri); + } else { + nsptr = xmlSearchNsByHref(nodep-doc, nodep, (xmlChar*) uri); + } } else { nsptr = NULL; } @@ -3367,9 +3371,13 @@ sprintf(prefixtmp, a%d, random); prefix = prefixtmp; } - nsptr = xmlNewNs(nodep, uri, prefix); + if (nodep-type == XML_ATTRIBUTE_NODE) { + nsptr = xmlNewNs(nodep-parent, uri, prefix); + } else { + nsptr = xmlNewNs(nodep, uri, prefix); + } } - + xmlSetNs(nodep, nsptr); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
sniper Wed Mar 19 20:27:40 2003 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: WS CS fixes.. Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.239 php4/ext/domxml/php_domxml.c:1.240 --- php4/ext/domxml/php_domxml.c:1.239 Thu Mar 6 18:07:23 2003 +++ php4/ext/domxml/php_domxml.cWed Mar 19 20:27:40 2003 @@ -16,20 +16,18 @@ +--+ */ -/* $Id: php_domxml.c,v 1.239 2003/03/06 23:07:23 ddhill Exp $ */ +/* $Id: php_domxml.c,v 1.240 2003/03/20 01:27:40 sniper Exp $ */ /* TODO * - Support Notation Nodes * */ - #ifdef HAVE_CONFIG_H #include config.h #endif #include php.h #include ext/standard/php_rand.h - #include php_domxml.h #if HAVE_DOMXML @@ -38,7 +36,6 @@ #define PHP_XPTR 2 /* General macros used by domxml */ - #define DOMXML_IS_TYPE(zval, ce) (zval Z_TYPE_P(zval) == IS_OBJECT Z_OBJCE_P(zval)-refcount == ce-refcount) #define DOMXML_DOMOBJ_NEW(zval, obj, ret) if (NULL == (zval = php_domobject_new(obj, ret, zval TSRMLS_CC))) { \ @@ -163,7 +160,6 @@ static int le_domxmlentityrefp; /*static int le_domxmlnsp;*/ - #if HAVE_DOMXSLT static int le_domxsltstylesheetp; #endif @@ -200,7 +196,6 @@ zend_class_entry *domxsltstylesheet_class_entry; #endif - static int node_attributes(zval **attributes, xmlNode *nodep TSRMLS_DC); static int node_children(zval **children, xmlNode *nodep TSRMLS_DC); @@ -211,16 +206,16 @@ static zend_function_entry domxml_functions[] = { PHP_FE(domxml_version, NULL) PHP_FE(xmldoc, third_args_force_ref) - PHP_FALIAS(domxml_open_mem, xmldoc, third_args_force_ref) - PHP_FE(xmldocfile, third_args_force_ref) - PHP_FALIAS(domxml_open_file,xmldocfile, third_args_force_ref) + PHP_FALIAS(domxml_open_mem, xmldoc, third_args_force_ref) + PHP_FE(xmldocfile, third_args_force_ref) + PHP_FALIAS(domxml_open_file, xmldocfile, third_args_force_ref) #if defined(LIBXML_HTML_ENABLED) PHP_FE(html_doc, NULL) PHP_FE(html_doc_file, NULL) #endif - PHP_FE(domxml_xmltree, NULL) - PHP_FALIAS(xmltree, domxml_xmltree, NULL) - PHP_FE(domxml_substitute_entities_default, NULL) + PHP_FE(domxml_xmltree, NULL) + PHP_FALIAS(xmltree, domxml_xmltree, NULL) + PHP_FE(domxml_substitute_entities_default, NULL) PHP_FE(domxml_doc_document_element, NULL) PHP_FE(domxml_doc_add_root, NULL) PHP_FE(domxml_doc_set_root, NULL) @@ -243,7 +238,7 @@ PHP_FE(domxml_node_add_namespace, NULL) PHP_FE(domxml_node_set_namespace, NULL) PHP_FE(domxml_new_xmldoc, NULL) - PHP_FALIAS(domxml_new_doc, domxml_new_xmldoc, NULL) + PHP_FALIAS(domxml_new_doc, domxml_new_xmldoc, NULL) PHP_FE(domxml_parser, NULL) PHP_FE(domxml_parser_add_chunk, NULL)
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
chregu Tue Mar 4 08:38:39 2003 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: MFB (make it really W3C compatible (unlink node, when in tree...)) Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.236 php4/ext/domxml/php_domxml.c:1.237 --- php4/ext/domxml/php_domxml.c:1.236 Thu Feb 13 16:41:00 2003 +++ php4/ext/domxml/php_domxml.cTue Mar 4 08:38:38 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.236 2003/02/13 21:41:00 helly Exp $ */ +/* $Id: php_domxml.c,v 1.237 2003/03/04 13:38:38 chregu Exp $ */ /* TODO * - Support Notation Nodes @@ -2329,8 +2329,8 @@ RETURN_FALSE; } - /* first unlink node, if child is already a child of parent */ - if (child-parent == parent){ + /* first unlink node, if child is already in the tree */ + if (child-doc == parent-doc child-parent != NULL){ xmlUnlinkNode(child); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
helly Thu Feb 13 16:41:01 2003 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: pass tsrmls instead of fetching it always Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.235 php4/ext/domxml/php_domxml.c:1.236 --- php4/ext/domxml/php_domxml.c:1.235 Sat Jan 18 14:49:23 2003 +++ php4/ext/domxml/php_domxml.cThu Feb 13 16:41:00 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.235 2003/01/18 19:49:23 iliaa Exp $ */ +/* $Id: php_domxml.c,v 1.236 2003/02/13 21:41:00 helly Exp $ */ /* TODO * - Support Notation Nodes @@ -896,10 +896,9 @@ return ((zval *) (((xmlXPathContextPtr) obj)-user)); } -static void php_xpath_set_context(zval *wrapper, void *obj, int rsrc_type) +static void php_xpath_set_context(zval *wrapper, void *obj, int rsrc_type TSRMLS_DC) { zval *handle, *addr; - TSRMLS_FETCH(); MAKE_STD_ZVAL(handle); Z_TYPE_P(handle) = IS_LONG; @@ -940,7 +939,7 @@ */ object_init_ex(wrapper, xpathctx_class_entry); rsrc_type = le_xpathctxp; - php_xpath_set_context(wrapper, (void *) obj, rsrc_type); + php_xpath_set_context(wrapper, (void *) obj, rsrc_type TSRMLS_CC); return (wrapper); } @@ -952,10 +951,9 @@ } -static void php_xmlparser_set_object(zval *wrapper, void *obj, int rsrc_type) +static void php_xmlparser_set_object(zval *wrapper, void *obj, int rsrc_type +TSRMLS_DC) { zval *handle, *addr; - TSRMLS_FETCH(); MAKE_STD_ZVAL(handle); Z_TYPE_P(handle) = IS_LONG; @@ -988,7 +986,7 @@ MAKE_STD_ZVAL(wrapper); object_init_ex(wrapper, domxmlparser_class_entry); rsrc_type = le_domxmlparserp; - php_xmlparser_set_object(wrapper, (void *) obj, rsrc_type); + php_xmlparser_set_object(wrapper, (void *) obj, rsrc_type TSRMLS_CC); return (wrapper); } @@ -1070,10 +1068,9 @@ } -static void php_dom_set_object(zval *wrapper, void *obj, int rsrc_type) +static void php_dom_set_object(zval *wrapper, void *obj, int rsrc_type TSRMLS_DC) { zval *handle, *addr; - TSRMLS_FETCH(); MAKE_STD_ZVAL(handle); Z_TYPE_P(handle) = IS_LONG; @@ -1311,7 +1308,7 @@ return NULL; } - php_dom_set_object(wrapper, (void *) obj, rsrc_type); + php_dom_set_object(wrapper, (void *) obj, rsrc_type TSRMLS_CC); return (wrapper); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
iliaa Tue Jan 14 15:07:55 2003 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: Changed getParameters() to zend_get_parameters_ex(). Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.233 php4/ext/domxml/php_domxml.c:1.234 --- php4/ext/domxml/php_domxml.c:1.233 Mon Jan 13 03:19:50 2003 +++ php4/ext/domxml/php_domxml.cTue Jan 14 15:07:52 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.233 2003/01/13 08:19:50 derick Exp $ */ +/* $Id: php_domxml.c,v 1.234 2003/01/14 20:07:52 iliaa Exp $ */ /* TODO * - Support Notation Nodes @@ -1636,13 +1636,14 @@ Unity function for testing */ PHP_FUNCTION(domxml_test) { - zval *id; + zval **id; - if ((ZEND_NUM_ARGS() != 1) || getParameters(ht, 1, id) == FAILURE) + if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, id) == FAILURE)) { WRONG_PARAM_COUNT; + } - convert_to_long(id); - RETURN_LONG(Z_LVAL_P(id)); + convert_to_long_ex(id); + RETURN_LONG(Z_LVAL_PP(id)); } /* }}} */ @@ -2854,18 +2855,18 @@ /* since this function is not implemented, outcomment it for the time beeing PHP_FUNCTION(domxml_elem_set_attribute_node) { - zval *id, *arg1, *rv = NULL; + zval *id, **arg1, *rv = NULL; xmlNode *nodep; xmlAttr *attrp, *newattrp; int ret; - if ((ZEND_NUM_ARGS() == 1) getParameters(ht, 1, arg1) == SUCCESS) { - id = getThis(); - nodep = php_dom_get_object(id, le_domxmlelementp, 0 TSRMLS_CC); - attrp = php_dom_get_object(arg1, le_domxmlattrp, 0 TSRMLS_CC); - } else { + if ((ZEND_NUM_ARGS() == 1) (zend_get_parameters_ex(1, arg1) == FAILURE) { WRONG_PARAM_COUNT; } + + id = getThis(); + nodep = php_dom_get_object(id, le_domxmlelementp, 0 TSRMLS_CC); + attrp = php_dom_get_object(*arg1, le_domxmlattrp, 0 TSRMLS_CC); FIXME: The following line doesn't work newattrp = xmlCopyProp(nodep, attrp); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
derick Mon Jan 13 03:19:52 2003 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: - Fix ZTS build Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.232 php4/ext/domxml/php_domxml.c:1.233 --- php4/ext/domxml/php_domxml.c:1.232 Fri Jan 10 13:07:36 2003 +++ php4/ext/domxml/php_domxml.cMon Jan 13 03:19:50 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.232 2003/01/10 18:07:36 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.233 2003/01/13 08:19:50 derick Exp $ */ /* TODO * - Support Notation Nodes @@ -899,6 +899,7 @@ static void php_xpath_set_context(zval *wrapper, void *obj, int rsrc_type) { zval *handle, *addr; + TSRMLS_FETCH(); MAKE_STD_ZVAL(handle); Z_TYPE_P(handle) = IS_LONG; @@ -954,6 +955,7 @@ static void php_xmlparser_set_object(zval *wrapper, void *obj, int rsrc_type) { zval *handle, *addr; + TSRMLS_FETCH(); MAKE_STD_ZVAL(handle); Z_TYPE_P(handle) = IS_LONG; @@ -1071,6 +1073,7 @@ static void php_dom_set_object(zval *wrapper, void *obj, int rsrc_type) { zval *handle, *addr; + TSRMLS_FETCH(); MAKE_STD_ZVAL(handle); Z_TYPE_P(handle) = IS_LONG; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
iliaa Tue Jan 7 09:34:42 2003 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: Fixed ZTS build with ZE2. Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.230 php4/ext/domxml/php_domxml.c:1.231 --- php4/ext/domxml/php_domxml.c:1.230 Mon Jan 6 04:59:53 2003 +++ php4/ext/domxml/php_domxml.cTue Jan 7 09:34:41 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.230 2003/01/06 09:59:53 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.231 2003/01/07 14:34:41 iliaa Exp $ */ /* TODO * - Support Notation Nodes @@ -782,7 +782,7 @@ return obj; } -static void php_xsltstylesheet_set_object(zval *wrapper, void *obj, int rsrc_type) +static void php_xsltstylesheet_set_object(zval *wrapper, void *obj, int rsrc_type +TSRMLS_DC) { zval *handle, *addr; @@ -4992,7 +4992,7 @@ object_init_ex(wrapper, domxsltstylesheet_class_entry); rsrc_type = le_domxsltstylesheetp; - php_xsltstylesheet_set_object(wrapper, (void *) obj, rsrc_type); + php_xsltstylesheet_set_object(wrapper, (void *) obj, rsrc_type TSRMLS_CC); return (wrapper); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
chregu Mon Jan 6 03:47:35 2003 EDT Modified files: /php4/ext/domxmlphp_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.cMon 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
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c php_domxml.h
chregu Mon Jan 6 04:59:54 2003 EDT Modified files: /php4/ext/domxmlphp_domxml.c php_domxml.h Log: - get_path forgotten in .h file - fix crash in domxml_node_insert_before() (by Lukas Schröder) Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.229 php4/ext/domxml/php_domxml.c:1.230 --- php4/ext/domxml/php_domxml.c:1.229 Mon Jan 6 03:47:35 2003 +++ php4/ext/domxml/php_domxml.cMon Jan 6 04:59:53 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.229 2003/01/06 08:47:35 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.230 2003/01/06 09:59:53 chregu Exp $ */ /* TODO * - Support Notation Nodes @@ -2426,9 +2426,40 @@ DOMXML_GET_OBJ(child, node, le_domxmlnodep); + new_child = NULL; + if (ref != NULL) { DOMXML_GET_OBJ(refp, ref, le_domxmlnodep); - new_child = xmlAddPrevSibling(refp, child); + +/* + * The following code is from libxml2/tree.c + * libxml does free textnodes, if there are adjacent TEXT nodes + * This is bad behaviour for domxml, since then we have have reference + * to undefined nodes. The idea here is, that we do this text +comparison + * by ourself and not free the nodes. and only if libxml2 won't do +any harm + * call the function from libxml2. + * The code is exactly the same as in libxml2, only xmlFreeNode was +taken away. + */ + + if (child-type == XML_TEXT_NODE) { + if (refp-type == XML_TEXT_NODE) { + xmlChar *tmp; + + tmp = xmlStrdup(child-content); + tmp = xmlStrcat(tmp, refp-content); + xmlNodeSetContent(refp, tmp); + xmlFree(tmp); + new_child = refp; + } + if ((refp-prev != NULL) (refp-prev-type == XML_TEXT_NODE) +(refp-name == refp-prev-name)) { + xmlNodeAddContent(refp-prev, child-content); + new_child = refp-prev; + } + } + + if (new_child == NULL) + new_child = xmlAddPrevSibling(refp, child); } else { /* first unlink node, if child is already a child of parent for some strange reason, this is needed Index: php4/ext/domxml/php_domxml.h diff -u php4/ext/domxml/php_domxml.h:1.74 php4/ext/domxml/php_domxml.h:1.75 --- php4/ext/domxml/php_domxml.h:1.74 Tue Dec 31 11:06:32 2002 +++ php4/ext/domxml/php_domxml.hMon Jan 6 04:59:53 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.h,v 1.74 2002/12/31 16:06:32 sebastian Exp $ */ +/* $Id: php_domxml.h,v 1.75 2003/01/06 09:59:53 chregu Exp $ */ #ifndef PHP_DOMXML_H #define PHP_DOMXML_H @@ -153,6 +153,7 @@ PHP_FUNCTION(domxml_node_get_content); PHP_FUNCTION(domxml_node_text_concat); PHP_FUNCTION(domxml_node_set_name); +PHP_FUNCTION(domxml_node_get_path); PHP_FUNCTION(domxml_node_name); PHP_FUNCTION(domxml_node_type); PHP_FUNCTION(domxml_node_value); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
chregu Mon Dec 9 03:14:16 2002 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: PHP_FALIAS for doc_get_elements_by_tagname got lost Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.226 php4/ext/domxml/php_domxml.c:1.227 --- php4/ext/domxml/php_domxml.c:1.226 Thu Dec 5 16:50:21 2002 +++ php4/ext/domxml/php_domxml.cMon Dec 9 03:14:15 2002 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.226 2002/12/05 21:50:21 helly Exp $ */ +/* $Id: php_domxml.c,v 1.227 2002/12/09 08:14:15 chregu Exp $ */ /* TODO * - Support Notation Nodes @@ -317,6 +317,7 @@ PHP_FALIAS(create_cdata_section,domxml_doc_create_cdata_section, NULL) PHP_FALIAS(create_entity_reference, domxml_doc_create_entity_reference, NULL) PHP_FALIAS(create_processing_instruction, domxml_doc_create_processing_instruction, NULL) + PHP_FALIAS(get_elements_by_tagname, domxml_doc_get_elements_by_tagname, + NULL) PHP_FALIAS(get_element_by_id, domxml_doc_get_element_by_id, NULL) /* Everything below this comment is none DOM compliant */ /* children is deprecated because it is inherited from DomNode */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
chregu Sat Nov 30 05:38:18 2002 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: fixed big bad memory leak in xpath objects. Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.224 php4/ext/domxml/php_domxml.c:1.225 --- php4/ext/domxml/php_domxml.c:1.224 Fri Nov 29 11:31:41 2002 +++ php4/ext/domxml/php_domxml.cSat Nov 30 05:38:17 2002 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.224 2002/11/29 16:31:41 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.225 2002/11/30 10:38:17 chregu Exp $ */ /* TODO * - Support Notation Nodes @@ -698,19 +698,6 @@ xmlXPathFreeContext(ctx); } } - -static void php_free_xpath_object(zend_rsrc_list_entry *rsrc TSRMLS_DC) -{ - xmlXPathObjectPtr obj = (xmlXPathObjectPtr) rsrc-ptr; - - if (obj) { - if (obj-user) { - zval *wrapper = obj-user; - zval_ptr_dtor(wrapper); - } - xmlXPathFreeObject(obj); - } -} #endif static void php_free_xml_parser(zend_rsrc_list_entry *rsrc TSRMLS_DC) @@ -843,79 +830,12 @@ return obj; } - -static void xpath_object_set_data(void *obj, zval *wrapper) -{ -/* - char tmp[20]; - sprintf(tmp, %08X, obj); - fprintf(stderr, Adding %s to hash\n, tmp); -*/ - ((xmlXPathObjectPtr) obj)-user = wrapper; -} - - -static zval *xpath_object_get_data(void *obj) -{ -/* - char tmp[20]; - sprintf(tmp, %08X, obj); - fprintf(stderr, Trying getting %s from hash ..., tmp); - if(((xmlXPathObjectPtr) obj)-user) - fprintf(stderr, found\n); - else - fprintf(stderr, not found\n); -*/ - return ((zval *) (((xmlXPathObjectPtr) obj)-user)); -} - - -static void php_xpath_set_object(zval *wrapper, void *obj, int rsrc_type) -{ - zval *handle, *addr; - - MAKE_STD_ZVAL(handle); - Z_TYPE_P(handle) = IS_LONG; - Z_LVAL_P(handle) = zend_list_insert(obj, rsrc_type); - - MAKE_STD_ZVAL(addr); - Z_TYPE_P(addr) = IS_LONG; - Z_LVAL_P(addr) = (int) obj; - - zend_hash_index_update(Z_OBJPROP_P(wrapper), 0, handle, sizeof(zval *), NULL); - zend_hash_index_update(Z_OBJPROP_P(wrapper), 1, addr, sizeof(zval *), NULL); - zval_add_ref(wrapper); - xpath_object_set_data(obj, wrapper); -} - static zval *php_xpathobject_new(xmlXPathObjectPtr obj, int *found TSRMLS_DC) { zval *wrapper; - *found = 0; - - if (!obj) { - MAKE_STD_ZVAL(wrapper); - ZVAL_NULL(wrapper); - return wrapper; - } - - if ((wrapper = (zval *) xpath_object_get_data((void *) obj))) { - zval_add_ref(wrapper); - *found = 1; - return wrapper; - } - MAKE_STD_ZVAL(wrapper); object_init_ex(wrapper, xpathobject_class_entry); - -/* - rsrc_type = le_xpathobjectp; - php_xpath_set_object(wrapper, (void *) obj, rsrc_type); -*/ - - php_xpath_set_object(wrapper, (void *) obj, le_xpathobjectp); - return (wrapper); } @@ -1575,7 +1495,7 @@ #if defined(LIBXML_XPATH_ENABLED) le_xpathctxp = zend_register_list_destructors_ex(php_free_xpath_context, NULL, xpathcontext, module_number); - le_xpathobjectp = zend_register_list_destructors_ex(php_free_xpath_object, NULL, xpathobject, module_number); + le_xpathobjectp = zend_register_list_destructors_ex(NULL, NULL, xpathobject, +module_number); #endif /* le_domxmlnsp = register_list_destructors(NULL, NULL); */ @@ -4853,6 +4773,7 @@ break; } + xmlXPathFreeObject(xpathobjp); *return_value = *rv; FREE_ZVAL(rv); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
chregu Fri Nov 29 05:24:44 2002 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: do some kind of automatic namespace registration in xpath_eval(). This works only for namespaces defined in the context node (eg docroot if no second argument is given. If one wants to use namespaces defined elsewhere or with different prefixes, you still have to use xpath_ns_register() Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.221 php4/ext/domxml/php_domxml.c:1.222 --- php4/ext/domxml/php_domxml.c:1.221 Fri Nov 29 02:50:37 2002 +++ php4/ext/domxml/php_domxml.cFri Nov 29 05:24:44 2002 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.221 2002/11/29 07:50:37 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.222 2002/11/29 10:24:44 chregu Exp $ */ /* TODO * - Support Notation Nodes @@ -4735,9 +4735,9 @@ xmlXPathContextPtr ctxp; xmlXPathObjectPtr xpathobjp; xmlNode *contextnodep; - int ret, str_len; + int ret, str_len, nsNr; char *str; - + xmlNsPtr *namespaces; contextnode = NULL; contextnodep = NULL; @@ -4761,6 +4761,26 @@ DOMXML_GET_OBJ(contextnodep, contextnode, le_domxmlnodep); } ctxp-node = contextnodep; + + /* automatic namespace definitions registration. + it's only done for the context node + if you need namespaces defined in other nodes, + you have to specify them explicitely with + xpath_register_ns(); + */ + if (contextnodep) { + namespaces = xmlGetNsList(ctxp-doc, contextnodep); + } else { + namespaces = xmlGetNsList(ctxp-doc, xmlDocGetRootElement(ctxp-doc)); + } + + nsNr = 0; + if (namespaces != NULL) { + while (namespaces[nsNr] != NULL) { + xmlXPathRegisterNs(ctxp, namespaces[nsNr]-prefix, +namespaces[nsNr]-href); + nsNr++; + } + } #if defined(LIBXML_XPTR_ENABLED) if (mode == PHP_XPTR) { @@ -4884,20 +4904,25 @@ int prefix_len, uri_len, result; xmlXPathContextPtr ctxp; - char *prefix, *uri, *uri_static; + char *prefix, *uri; zval *id; DOMXML_PARAM_FOUR(ctxp, id, le_xpathctxp, ss, prefix, prefix_len, uri, uri_len); - /* set the context node to NULL - what is a context node anyway? */ ctxp-node = NULL; + #ifdef CHREGU_0 + /* this leads to memleaks... commenting it out, as it works for me without +copying + it. chregu */ /* this is a hack - libxml2 doesn't copy the URI, it simply uses the string given in the parameter - which is normally deallocated after the function */ -uri_static = estrndup(uri, uri_len); + uri_static = estrndup(uri, uri_len); result = xmlXPathRegisterNs(ctxp, prefix, uri_static); + #endif + + result = xmlXPathRegisterNs(ctxp, prefix, uri); if (0 == result) { RETURN_TRUE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
chregu Fri Nov 29 02:50:38 2002 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: get_element_by_id does not need LIBXML_XPATH support Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.220 php4/ext/domxml/php_domxml.c:1.221 --- php4/ext/domxml/php_domxml.c:1.220 Tue Nov 26 10:37:54 2002 +++ php4/ext/domxml/php_domxml.cFri Nov 29 02:50:37 2002 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.220 2002/11/26 15:37:54 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.221 2002/11/29 07:50:37 chregu Exp $ */ /* TODO * - Support Notation Nodes @@ -265,8 +265,10 @@ PHP_FE(xpath_eval_expression, NULL) PHP_FE(xpath_register_ns, NULL) PHP_FE(domxml_doc_get_elements_by_tagname, NULL) - PHP_FE(domxml_doc_get_element_by_id, NULL) #endif + + PHP_FE(domxml_doc_get_element_by_id, + NULL) + #if defined(LIBXML_XPTR_ENABLED) PHP_FE(xptr_new_context, NULL) PHP_FE(xptr_eval, NULL) @@ -314,7 +316,6 @@ PHP_FALIAS(create_cdata_section,domxml_doc_create_cdata_section, NULL) PHP_FALIAS(create_entity_reference, domxml_doc_create_entity_reference, NULL) PHP_FALIAS(create_processing_instruction, domxml_doc_create_processing_instruction, NULL) - PHP_FALIAS(get_elements_by_tagname, domxml_doc_get_elements_by_tagname, NULL) PHP_FALIAS(get_element_by_id, domxml_doc_get_element_by_id, NULL) /* Everything below this comment is none DOM compliant */ /* children is deprecated because it is inherited from DomNode */ @@ -433,7 +434,9 @@ /* since this function is not implemented, outcomment it for the time beeing PHP_FALIAS(set_attribute_node, domxml_elem_set_attribute_node, NULL) */ +#if defined(LIBXML_XPATH_ENABLED) PHP_FALIAS(get_elements_by_tagname, domxml_elem_get_elements_by_tagname, NULL) +#endif PHP_FALIAS(has_attribute, domxml_elem_has_attribute, NULL) {NULL, NULL, NULL} }; @@ -2993,6 +2996,7 @@ FREE_ZVAL(rv); } /* }}} */ +#endif typedef struct _idsIterator idsIterator; struct _idsIterator { @@ -3034,7 +3038,6 @@ } } /* }}} */ -#endif /* {{{ proto string domxml_elem_get_elements_by_tagname(string tagname) Returns array with nodes with given tagname in element or empty array, if not found */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
helly Fri Nov 15 06:06:14 2002 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: Fix segfaults (check ext/domxml/tests/domxml002.phpt) Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.218 php4/ext/domxml/php_domxml.c:1.219 --- php4/ext/domxml/php_domxml.c:1.218 Fri Nov 1 05:06:10 2002 +++ php4/ext/domxml/php_domxml.cFri Nov 15 06:06:13 2002 -16,7 +16,7 +--+ */ -/* $Id: php_domxml.c,v 1.218 2002/11/01 10:06:10 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.219 2002/11/15 11:06:13 helly Exp $ */ /* TODO * - Support Notation Nodes -572,7 +572,7 zval *wrapper; int refcount = 0; /* FIXME: type check probably unnecessary here? */ - if (!node || Z_TYPE_P(node) == XML_DTD_NODE) + if (!node) /* || Z_TYPE_P(node) == XML_DTD_NODE)*/ return; wrapper = dom_object_get_data(node); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
chregu Fri Nov 1 05:06:10 2002 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: fix for bug #20209 (appending text nodes leads to segfaults sometimes) Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.217 php4/ext/domxml/php_domxml.c:1.218 --- php4/ext/domxml/php_domxml.c:1.217 Thu Oct 31 14:52:45 2002 +++ php4/ext/domxml/php_domxml.cFri Nov 1 05:06:10 2002 -16,7 +16,7 +--+ */ -/* $Id: php_domxml.c,v 1.217 2002/10/31 19:52:45 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.218 2002/11/01 10:06:10 chregu Exp $ */ /* TODO * - Support Notation Nodes -2360,7 +2360,7 PHP_FUNCTION(domxml_node_append_child) { zval *id, *rv = NULL, *node; - xmlNodePtr child, parent, new_child; + xmlNodePtr child, parent, new_child = NULL; int ret; DOMXML_PARAM_ONE(parent, id, le_domxmlnodep, o, node); -2381,7 +2381,34 if (child-parent == parent){ xmlUnlinkNode(child); } - new_child = xmlAddChild(parent, child); + + /* +* The following code is from libxml2/tree.c and a fix for bug #20209 +* libxml does free textnodes, if there are adjacent TEXT nodes +* This is bad behaviour for domxml, since then we have have reference +* to undefined nodes. The idea here is, that we do this text comparison +* by ourself and not free the nodes. and only if libxml2 won't do any harm +* call the function from libxml2. +* The code is exactly the same as in libxml2, only xmlFreeNode was taken away. +*/ + + if (child-type == XML_TEXT_NODE) { + if ((parent-type == XML_TEXT_NODE) + (parent-content != NULL)) { + xmlNodeAddContent(parent, child-content); + new_child = parent; + } + if ((parent-last != NULL) (parent-last-type == XML_TEXT_NODE) + (parent-last-name == child-name)) { + xmlNodeAddContent(parent-last, child-content); + new_child = parent-last; + } + } + /* end libxml2 code */ + + if (NULL == new_child) { + new_child = xmlAddChild(parent, child); + } if (NULL == new_child) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Couldn't append node); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
chregu Thu Oct 31 14:52:46 2002 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: fix proto for clone_node Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.216 php4/ext/domxml/php_domxml.c:1.217 --- php4/ext/domxml/php_domxml.c:1.216 Tue Oct 29 11:57:52 2002 +++ php4/ext/domxml/php_domxml.cThu Oct 31 14:52:45 2002 -16,7 +16,7 +--+ */ -/* $Id: php_domxml.c,v 1.216 2002/10/29 16:57:52 helly Exp $ */ +/* $Id: php_domxml.c,v 1.217 2002/10/31 19:52:45 chregu Exp $ */ /* TODO * - Support Notation Nodes -2035,7 +2035,7 } /* }}} */ -/* {{{ proto bool domxml_clone_node(void) +/* {{{ proto object domxml_clone_node([bool deep]) Clones a node */ PHP_FUNCTION(domxml_clone_node) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
helly Tue Oct 29 11:45:20 2002 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: -php_error = php_error_docref -two warnings Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.214 php4/ext/domxml/php_domxml.c:1.215 --- php4/ext/domxml/php_domxml.c:1.214 Mon Oct 28 03:54:30 2002 +++ php4/ext/domxml/php_domxml.cTue Oct 29 11:45:19 2002 -16,7 +16,7 +--+ */ -/* $Id: php_domxml.c,v 1.214 2002/10/28 08:54:30 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.215 2002/10/29 16:45:19 helly Exp $ */ /* TODO * - Support Notation Nodes -42,8 +42,7 #define DOMXML_IS_TYPE(zval, ce) (zval Z_TYPE_P(zval) == IS_OBJECT Z_OBJCE_P(zval)-refcount == ce-refcount) #define DOMXML_DOMOBJ_NEW(zval, obj, ret) if (NULL == (zval = php_domobject_new(obj, ret, zval TSRMLS_CC))) { \ - php_error(E_WARNING, %s(): cannot create required DOM object, \ - get_active_function_name(TSRMLS_C)); \ + + php_error_docref(NULL TSRMLS_CC, E_WARNING, Cannot create +required DOM object); \ RETURN_FALSE; \ } -55,14 +54,12 DOMXML_RET_ZVAL(zval); #define DOMXML_GET_THIS(zval) if (NULL == (zval = getThis())) { \ - php_error(E_WARNING, %s(): underlying object missing, \ - get_active_function_name(TSRMLS_C)); \ + + php_error_docref(NULL TSRMLS_CC, E_WARNING, Underlying +object missing); \ RETURN_FALSE; \ } #define DOMXML_GET_OBJ(ret, zval, le) if (NULL == (ret = php_dom_get_object(zval, le, 0 TSRMLS_CC))) { \ - php_error(E_WARNING, %s(): cannot fetch DOM object, \ - get_active_function_name(TSRMLS_C)); \ + + php_error_docref(NULL TSRMLS_CC, E_WARNING, Cannot fetch +DOM object); \ RETURN_FALSE; \ } -70,13 +67,11 DOMXML_GET_OBJ(ret, zval, le); #define DOMXML_NO_ARGS() if (ZEND_NUM_ARGS() != 0) { \ - php_error(E_WARNING, %s(): expects exactly 0 parameters, %d given, \ - get_active_function_name(TSRMLS_C), ZEND_NUM_ARGS()); \ + + php_error_docref(NULL TSRMLS_CC, E_WARNING, Expects exactly +0 parameters, %d given, ZEND_NUM_ARGS()); \ return; \ } -#define DOMXML_NOT_IMPLEMENTED() php_error(E_WARNING, %s(): not yet implemented, \ -
Re: [PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
hi excuse my ignorant question, but: @@ -740,6 +740,7 @@ } +#ifdef HELLY_0 is this intended? chregu static zval *xsltstylesheet_get_data(void *obj) { /* @@ -753,6 +754,7 @@ */ return ((zval *) (((xsltStylesheetPtr) obj)-_private)); } +#endif void *php_xsltstylesheet_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC) { @@ -3764,7 +3766,7 @@ PHP_FUNCTION(xmldoc) { zval *rv = NULL; - xmlDoc *docp; + xmlDoc *docp = NULL; int ret; char *buffer; int buffer_len; @@ -3851,7 +3853,7 @@ PHP_FUNCTION(xmldocfile) { zval *rv = NULL; - xmlDoc *docp; + xmlDoc *docp = NULL; int ret, file_len; char *file; int mode = 0, prevSubstValue; -- nam...christian stockeradr...bremgartnerstr. 66, ch-8003 zurich pho...+41 1 451 6021 www...http://phant.ch/chregu mob...+41 76 561 8860 [EMAIL PROTECTED] wor...+41 1 240 5670 gpg...0x5CE1DECB -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
Confirms to CODING_STANDARDS. I only had to change the order. Perhaps we should rewrite that parg 9. [9] When commenting out code using a #if statement, do NOT use 0 only. Append to any 0 an _cvs username here. For example, #if 0_FOO, where FOO is cvs user foo. This allows easier tracking of why code was commented out, especially in bundled libraries. marcus At 18:00 29.10.2002, Christian Stocker wrote: hi excuse my ignorant question, but: @@ -740,6 +740,7 @@ } +#ifdef HELLY_0 is this intended? chregu static zval *xsltstylesheet_get_data(void *obj) { /* @@ -753,6 +754,7 @@ */ return ((zval *) (((xsltStylesheetPtr) obj)-_private)); } +#endif void *php_xsltstylesheet_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC) { @@ -3764,7 +3766,7 @@ PHP_FUNCTION(xmldoc) { zval *rv = NULL; - xmlDoc *docp; + xmlDoc *docp = NULL; int ret; char *buffer; int buffer_len; @@ -3851,7 +3853,7 @@ PHP_FUNCTION(xmldocfile) { zval *rv = NULL; - xmlDoc *docp; + xmlDoc *docp = NULL; int ret, file_len; char *file; int mode = 0, prevSubstValue; -- nam...christian stockeradr...bremgartnerstr. 66, ch-8003 zurich pho...+41 1 451 6021 www...http://phant.ch/chregu mob...+41 76 561 8860 [EMAIL PROTECTED] wor...+41 1 240 5670 gpg...0x5CE1DECB -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
On Tue, 29 Oct 2002, Marcus Börger wrote: Confirms to CODING_STANDARDS. I only had to change the order. Perhaps we should rewrite that parg 9. [9] When commenting out code using a #if statement, do NOT use 0 only. Append to any 0 an _cvs username here. For example, #if 0_FOO, where FOO is cvs user foo. This allows easier tracking of why code was commented out, especially in bundled libraries. Then you need to swap the 0 and HELLY in your code I think :) +#ifdef HELLY_0 Derick -- --- Derick Rethans http://derickrethans.nl/ JDI Media Solutions --[ if you hold a unix shell to your ear, do you hear the c? ]- -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
At 18:48 29.10.2002, Derick Rethans wrote: On Tue, 29 Oct 2002, Marcus Börger wrote: Confirms to CODING_STANDARDS. I only had to change the order. Perhaps we should rewrite that parg 9. [9] When commenting out code using a #if statement, do NOT use 0 only. Append to any 0 an _cvs username here. For example, #if 0_FOO, where FOO is cvs user foo. This allows easier tracking of why code was commented out, especially in bundled libraries. Then you need to swap the 0 and HELLY in your code I think :) +#ifdef HELLY_0 As i already wrote it fails with #ifdef 0_HELLY [marcuszaphod php4-HEAD]$ make sapi/cli/php gcc -Iext/domxml/ -I/usr/src/php4-HEAD/ext/domxml/ [...] -o ext/domxml/php_domxml.o echo ext/domxml/php_domxml.lo /usr/src/php4-HEAD/ext/domxml/php_domxml.c:743:8: macro names must be identifiers make: *** [ext/domxml/php_domxml.lo] Error 1 [marcuszaphod php4-HEAD]$ So again i think we should rewrite paragraph 9 of CODING_STANDARDS. marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
sander Sat Oct 12 12:16:37 2002 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: Typo Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.212 php4/ext/domxml/php_domxml.c:1.213 --- php4/ext/domxml/php_domxml.c:1.212 Fri Oct 11 10:00:12 2002 +++ php4/ext/domxml/php_domxml.cSat Oct 12 12:16:36 2002 -16,7 +16,7 +--+ */ -/* $Id: php_domxml.c,v 1.212 2002/10/11 14:00:12 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.213 2002/10/12 16:16:36 sander Exp $ */ /* TODO * - Support Notation Nodes -2580,7 +2580,7 DOMXML_PARAM_NONE(nodep, id, le_domxmlnodep); ret = node_attributes(attrs, nodep TSRMLS_CC); if ( ret == -1) { - return NULL; + RETURN_NULL(); } if ( ret -1) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
chregu Fri Oct 11 10:00:12 2002 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: node-attributes returns null, if there are no attributes. Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.211 php4/ext/domxml/php_domxml.c:1.212 --- php4/ext/domxml/php_domxml.c:1.211 Mon Sep 9 16:32:49 2002 +++ php4/ext/domxml/php_domxml.cFri Oct 11 10:00:12 2002 -16,7 +16,7 +--+ */ -/* $Id: php_domxml.c,v 1.211 2002/09/09 20:32:49 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.212 2002/10/11 14:00:12 chregu Exp $ */ /* TODO * - Support Notation Nodes -2576,37 +2576,17 zval *id, *attrs; xmlNode *nodep; int ret; -#ifdef oldstyle_for_libxml_1_8_7 - xmlAttr *attr; -#endif DOMXML_PARAM_NONE(nodep, id, le_domxmlnodep); ret = node_attributes(attrs, nodep TSRMLS_CC); if ( ret == -1) { - RETURN_FALSE; + return NULL; } if ( ret -1) { *return_value = *attrs; FREE_ZVAL(attrs); } - - -#ifdef oldstyle_for_libxml_1_8_7 - attr = nodep-properties; - if (!attr) { - RETURN_FALSE; - } - - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } - - while (attr) { - add_assoc_string(return_value, (char *) attr-name, xmlNodeGetContent(attr), 1); - attr = attr-next; - } -#endif } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php