[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2005-03-17 Thread Rob Richards
rrichards   Thu Mar 17 08:11:48 2005 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  Fixed bug #32340 (insert_before($node,NULL) does not return)
  
http://cvs.php.net/diff.php/php-src/ext/domxml/php_domxml.c?r1=1.218.2.49r2=1.218.2.50ty=u
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.49 
php-src/ext/domxml/php_domxml.c:1.218.2.50
--- php-src/ext/domxml/php_domxml.c:1.218.2.49  Fri Feb 25 17:13:08 2005
+++ php-src/ext/domxml/php_domxml.c Thu Mar 17 08:11:47 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.49 2005/02/25 22:13:08 rrichards Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.50 2005/03/17 13:11:47 rrichards Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -2612,10 +2612,7 @@
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
-*/
-   if (child-parent == parent){
+   if (child-parent != NULL){
xmlUnlinkNode(child);
}
new_child = xmlAddChild(parent, child);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2005-02-25 Thread Rob Richards
rrichards   Fri Feb 25 17:13:09 2005 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  no message
  
http://cvs.php.net/diff.php/php-src/ext/domxml/php_domxml.c?r1=1.218.2.48r2=1.218.2.49ty=u
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.48 
php-src/ext/domxml/php_domxml.c:1.218.2.49
--- php-src/ext/domxml/php_domxml.c:1.218.2.48  Fri Aug 13 07:38:03 2004
+++ php-src/ext/domxml/php_domxml.c Fri Feb 25 17:13:08 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.48 2004/08/13 11:38:03 rrichards Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.49 2005/02/25 22:13:08 rrichards Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -2471,6 +2471,10 @@
}
/* end libxml2 code */
else if (child-type == XML_ATTRIBUTE_NODE) {
+   if (parent-type != XML_ELEMENT_NODE) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Element 
node required to append Attribute);
+   RETURN_FALSE;
+   }
if (parent-properties != NULL) {
/* Check if an attribute with the same name exists */
xmlAttrPtr foundattrp;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c php_domxml.h

2004-08-13 Thread Rob Richards
rrichards   Fri Aug 13 07:38:04 2004 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.h php_domxml.c 
  Log:
  Fixed bug #29599 (domxml_error segfaults another apache module)
  
http://cvs.php.net/diff.php/php-src/ext/domxml/php_domxml.h?r1=1.72.4.5r2=1.72.4.6ty=u
Index: php-src/ext/domxml/php_domxml.h
diff -u php-src/ext/domxml/php_domxml.h:1.72.4.5 
php-src/ext/domxml/php_domxml.h:1.72.4.6
--- php-src/ext/domxml/php_domxml.h:1.72.4.5Fri Sep 26 12:33:58 2003
+++ php-src/ext/domxml/php_domxml.h Fri Aug 13 07:38:03 2004
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: php_domxml.h,v 1.72.4.5 2003/09/26 16:33:58 moriyoshi Exp $ */
+/* $Id: php_domxml.h,v 1.72.4.6 2004/08/13 11:38:03 rrichards Exp $ */
 
 #ifndef PHP_DOMXML_H
 #define PHP_DOMXML_H
@@ -75,6 +75,8 @@
 /* directory functions */
 PHP_MINIT_FUNCTION(domxml);
 PHP_MSHUTDOWN_FUNCTION(domxml);
+PHP_RINIT_FUNCTION(domxml);
+PHP_RSHUTDOWN_FUNCTION(domxml);
 PHP_MINFO_FUNCTION(domxml);
 PHP_FUNCTION(domxml_version);
 PHP_FUNCTION(xmldoc);
http://cvs.php.net/diff.php/php-src/ext/domxml/php_domxml.c?r1=1.218.2.47r2=1.218.2.48ty=u
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.47 
php-src/ext/domxml/php_domxml.c:1.218.2.48
--- php-src/ext/domxml/php_domxml.c:1.218.2.47  Sat Jun 19 11:09:46 2004
+++ php-src/ext/domxml/php_domxml.c Fri Aug 13 07:38:03 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.47 2004/06/19 15:09:46 sesser Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.48 2004/08/13 11:38:03 rrichards Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -540,8 +540,8 @@
domxml_functions,
PHP_MINIT(domxml),
PHP_MSHUTDOWN(domxml),
-   NULL,
-   NULL,
+   PHP_RINIT(domxml),
+   PHP_RSHUTDOWN(domxml),
PHP_MINFO(domxml),
DOMXML_API_VERSION, /* Extension versionnumber */
STANDARD_MODULE_PROPERTIES
@@ -1510,6 +1510,24 @@

 }
 
+PHP_RINIT_FUNCTION(domxml)
+{
+   xmlSetGenericErrorFunc(xmlGenericErrorContext, 
(xmlGenericErrorFunc)domxml_error);
+#if HAVE_DOMXSLT
+   xsltSetGenericErrorFunc(xsltGenericErrorContext, 
(xmlGenericErrorFunc)domxml_error);
+#endif
+   return SUCCESS;
+}
+
+PHP_RSHUTDOWN_FUNCTION(domxml)
+{
+   xmlSetGenericErrorFunc(xmlGenericErrorContext, NULL);
+#if HAVE_DOMXSLT
+   xsltSetGenericErrorFunc(xsltGenericErrorContext, NULL);
+#endif
+   return SUCCESS;
+}
+
 PHP_MSHUTDOWN_FUNCTION(domxml)
 {
 #if HAVE_DOMXSLT
@@ -1668,15 +1686,9 @@
REGISTER_LONG_CONSTANT(DOMXML_LOAD_SUBSTITUTE_ENTITIES,   
DOMXML_LOAD_SUBSTITUTE_ENTITIES,CONST_CS | CONST_PERSISTENT);

REGISTER_LONG_CONSTANT(DOMXML_LOAD_COMPLETE_ATTRS,DOMXML_LOAD_COMPLETE_ATTRS,
 CONST_CS | CONST_PERSISTENT);

REGISTER_LONG_CONSTANT(DOMXML_LOAD_DONT_KEEP_BLANKS,DOMXML_LOAD_DONT_KEEP_BLANKS,
 CONST_CS | CONST_PERSISTENT);
-   xmlSetGenericErrorFunc(xmlGenericErrorContext, 
(xmlGenericErrorFunc)domxml_error);
-#if (defined(LIBXML_THREAD_ENABLED)  LIBXML_VERSION = 20511)
-   xmlThrDefSetGenericErrorFunc(xmlGenericErrorContext, 
(xmlGenericErrorFunc)domxml_error);
-#endif
-#if HAVE_DOMXSLT
-   xsltSetGenericErrorFunc(xsltGenericErrorContext, 
(xmlGenericErrorFunc)domxml_error);
-#if HAVE_DOMEXSLT
+
+#if HAVE_DOMXSLT  HAVE_DOMEXSLT
exsltRegisterAll();
-#endif
 #endif
xmlInitParser();
return SUCCESS;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2004-04-06 Thread Rob Richards
rrichards   Tue Apr  6 13:56:12 2004 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  Fix Bug #27769 crash using domxml_xmltree
  
http://cvs.php.net/diff.php/php-src/ext/domxml/php_domxml.c?r1=1.218.2.45r2=1.218.2.46ty=u
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.45 
php-src/ext/domxml/php_domxml.c:1.218.2.46
--- php-src/ext/domxml/php_domxml.c:1.218.2.45  Tue Feb 24 09:26:27 2004
+++ php-src/ext/domxml/php_domxml.c Tue Apr  6 13:56:11 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.45 2004/02/24 14:26:27 chregu Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.46 2004/04/06 17:56:11 rrichards Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -4803,15 +4803,17 @@
RETURN_FALSE;
}
 
-   DOMXML_RET_OBJ(rv, (xmlNodePtr) docp, ret);
+   DOMXML_DOMOBJ_NEW(rv, (xmlNodePtr) docp, ret);
 
/* The root itself maybe an array. Though you may not have two Elements
   as root, you may have a comment, pi and and element as root.
   Thanks to Paul DuBois for pointing me at this.
 */
if (node_children(children, root TSRMLS_CC) = 0) {
-   zend_hash_update(Z_OBJPROP_P(return_value), 
children,sizeof(children), (void *) children, sizeof(zval *), NULL);
+   zend_hash_update(Z_OBJPROP_P(rv), children,sizeof(children), (void 
*) children, sizeof(zval *), NULL);
}
+
+   DOMXML_RET_ZVAL(rv);
 /* xmlFreeDoc(docp); */
 }
 /* }}} */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2004-02-24 Thread Christian Stocker
chregu  Tue Feb 24 09:26:28 2004 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  fix for bug 27349 Invalid parsing of CDATA sections in XSL templates
  
  
http://cvs.php.net/diff.php/php-src/ext/domxml/php_domxml.c?r1=1.218.2.44r2=1.218.2.45ty=u
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.44 
php-src/ext/domxml/php_domxml.c:1.218.2.45
--- php-src/ext/domxml/php_domxml.c:1.218.2.44  Sat Dec 13 06:36:14 2003
+++ php-src/ext/domxml/php_domxml.c Tue Feb 24 09:26:27 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.44 2003/12/13 11:36:14 chregu Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.45 2004/02/24 14:26:27 chregu Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -3981,6 +3981,9 @@
 
ctxt-sax-error = domxml_error_ext;
ctxt-sax-warning = domxml_error_ext;
+#if LIBXML_VERSION = 20600
+   ctxt-sax-cdataBlock = NULL;
+#endif
ctxt-vctxt.userData= (void *) errorCtxt;
ctxt-vctxt.error= (xmlValidityErrorFunc) domxml_error_validate;
ctxt-vctxt.warning  = (xmlValidityWarningFunc) domxml_error_validate;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2003-12-13 Thread Christian Stocker
chregu  Sat Dec 13 06:36:15 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  fix for bug #26595 `XSLT_NAMESPACE' undeclared
  
  
  
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.43 
php-src/ext/domxml/php_domxml.c:1.218.2.44
--- php-src/ext/domxml/php_domxml.c:1.218.2.43  Fri Dec  5 14:21:05 2003
+++ php-src/ext/domxml/php_domxml.c Sat Dec 13 06:36:14 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.43 2003/12/05 19:21:05 rrichards Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.44 2003/12/13 11:36:14 chregu Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -200,9 +200,8 @@
 #endif
 #if HAVE_DOMXSLT
 zend_class_entry *domxsltstylesheet_class_entry;
-#endif
-
 static int xslt_has_xsl_keys (xmlDocPtr doc);
+#endif
 
 static int node_attributes(zval **attributes, xmlNode *nodep TSRMLS_DC);
 static int node_children(zval **children, xmlNode *nodep TSRMLS_DC);
@@ -4683,21 +4682,6 @@
 /* }}} */
 #endif
 
-static int xslt_has_xsl_keys (xmlDocPtr doc) {
-   
-   xmlNode *nodep;
-   nodep = xmlDocGetRootElement(doc)-children;
-   while (nodep) {
-   if (nodep-type == XML_ELEMENT_NODE  xmlStrEqual(nodep-name, key) 
 xmlStrEqual(nodep-ns-href, XSLT_NAMESPACE)) {
-   return 1;
-   break;
-   }
-   nodep = nodep-next;
-   }
-   return 0;
-}
-
-
 /* {{{ int node_attributes(zval **attributes, int node)
Returns list of children nodes */
 static int node_attributes(zval **attributes, xmlNode *nodep TSRMLS_DC)
@@ -5341,6 +5325,21 @@
 }
 /* }}} */
 
+static int xslt_has_xsl_keys (xmlDocPtr doc) {
+   
+   xmlNode *nodep;
+   nodep = xmlDocGetRootElement(doc)-children;
+   while (nodep) {
+   if (nodep-type == XML_ELEMENT_NODE  xmlStrEqual(nodep-name, key) 
 xmlStrEqual(nodep-ns-href, XSLT_NAMESPACE)) {
+   return 1;
+   break;
+   }
+   nodep = nodep-next;
+   }
+   return 0;
+}
+
+
 /* {{{ proto object domxml_xslt_process(object xslstylesheet, object xmldoc [, array 
xslt_parameters [, bool xpath_parameters [, string profileFilename]]])
Perform an XSLT transformation */
 PHP_FUNCTION(domxml_xslt_process)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2003-12-05 Thread Rob Richards
rrichards   Fri Dec  5 14:21:07 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  Fix bug #26531: get_elements_by_tag_name() wildcard fails
  
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.42 
php-src/ext/domxml/php_domxml.c:1.218.2.43
--- php-src/ext/domxml/php_domxml.c:1.218.2.42  Wed Dec  3 07:30:02 2003
+++ php-src/ext/domxml/php_domxml.c Fri Dec  5 14:21:05 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.42 2003/12/03 12:30:02 rrichards Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.43 2003/12/05 19:21:05 rrichards Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -708,9 +708,9 @@
   Namespace support
 */
if ( n != NULL  name != NULL ) {
-   cld = n-children;
+   cld = n;
while ( cld != NULL ) {
-   if ( xmlStrcmp( name, cld-name ) == 0 ){
+   if (cld-type == XML_ELEMENT_NODE  (xmlStrEqual(name, *) 
|| xmlStrcmp(name, cld-name) == 0)){
if ( rv == NULL ) {
rv = xmlXPathNodeSetCreate( cld ) ;
}
@@ -718,7 +718,7 @@
xmlXPathNodeSetAdd( rv, cld );
}
}
-   rv = php_get_elements_by_tagname(cld, name, rv);
+   rv = php_get_elements_by_tagname(cld-children, name, rv);
cld = cld-next;
}
}
@@ -3056,88 +3056,43 @@
 PHP_FUNCTION(domxml_doc_get_elements_by_tagname)
 {
zval *id, *rv, *contextnode = NULL,*ctxpin = NULL;
-   xmlXPathContextPtr ctxp;
xmlDocPtr docp;
+   xmlNode *contextnodep = NULL, *nodep = NULL;
+   int name_len,i;
+   char *name;
+   xmlNodeSet *nodesetp = NULL;
 
-   xmlXPathObjectPtr xpathobjp;
-   xmlNode *contextnodep;
-   int name_len;
-   int free_context = 0;
-   char *str,*name;
-
-   contextnode = NULL;
-   contextnodep = NULL;
-
-   DOMXML_PARAM_FOUR(docp, id, le_domxmldocp, s|oo, name, 
name_len,ctxpin,contextnodep);
-
-   /* if no xpath_context was submitted, create a new one */
-   if (ctxpin == NULL) {
-   ctxp = xmlXPathNewContext(docp);
-   free_context = 1;
-   } else {
-   DOMXML_GET_OBJ(ctxp, ctxpin, le_xpathctxp);
-   }
+   DOMXML_PARAM_FOUR(docp, id, le_domxmldocp, s|oo, name, 
name_len,ctxpin,contextnode);
 
if (contextnode) {
DOMXML_GET_OBJ(contextnodep, contextnode, le_domxmlnodep);
+   if (contextnodep-type == XML_ELEMENT_NODE) {
+   nodep = contextnodep-children;
+   }
+   } else {
+   nodep = xmlDocGetRootElement(docp);
}
-   ctxp-node = contextnodep;
-   str = (char*) emalloc((name_len+23) * sizeof(char)) ;
-   if (str == NULL) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Cannot allocate memory 
for string);
-   }
-   sprintf(str ,//*[local-name() = '%s'], name);
 
-   xpathobjp = xmlXPathEval(str, ctxp);
-   efree(str);
-   ctxp-node = NULL;
-   if (!xpathobjp) {
-   RETURN_FALSE;
-   }
MAKE_STD_ZVAL(rv);
 
-   if(array_init(rv) != SUCCESS)
-   {
+   if(array_init(rv) != SUCCESS) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Cannot create required 
array);
RETURN_FALSE;
}
 
-   switch (Z_TYPE_P(xpathobjp)) {
-
-   case XPATH_NODESET:
-   {
-   int i;
-   xmlNodeSetPtr nodesetp;
-
-   if (NULL == (nodesetp = xpathobjp-nodesetval)) {
-   zval_dtor(rv);
-   xmlXPathFreeObject (xpathobjp);
-   if (free_context) {
-   xmlXPathFreeContext(ctxp);
-   }
-   RETURN_FALSE;
-   }
-
-   for (i = 0; i  nodesetp-nodeNr; i++) {
-   xmlNodePtr node = nodesetp-nodeTab[i];
-   zval *child;
-   int retnode;
+   nodesetp = php_get_elements_by_tagname(nodep, name, NULL);
 
-   /* construct a node object */
-   child = php_domobject_new(node, retnode, NULL 
TSRMLS_CC);
-   zend_hash_next_index_insert(Z_ARRVAL_P(rv), child, 
sizeof(zval *), NULL);
-   }
+   if(nodesetp) {
+   for (i = 0; i  nodesetp-nodeNr; i++) {
+   xmlNodePtr node = 

[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2003-12-03 Thread Rob Richards
rrichards   Wed Dec  3 07:30:05 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  require libxml 2.5.11 for threaded error handling
  certain cases crash unlocking libxml mutex with earlier versions
  
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.41 
php-src/ext/domxml/php_domxml.c:1.218.2.42
--- php-src/ext/domxml/php_domxml.c:1.218.2.41  Tue Dec  2 10:09:31 2003
+++ php-src/ext/domxml/php_domxml.c Wed Dec  3 07:30:02 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.41 2003/12/02 15:09:31 rrichards Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.42 2003/12/03 12:30:02 rrichards Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -1670,7 +1670,7 @@

REGISTER_LONG_CONSTANT(DOMXML_LOAD_COMPLETE_ATTRS,DOMXML_LOAD_COMPLETE_ATTRS,
 CONST_CS | CONST_PERSISTENT);

REGISTER_LONG_CONSTANT(DOMXML_LOAD_DONT_KEEP_BLANKS,DOMXML_LOAD_DONT_KEEP_BLANKS,
 CONST_CS | CONST_PERSISTENT);
xmlSetGenericErrorFunc(xmlGenericErrorContext, 
(xmlGenericErrorFunc)domxml_error);
-#if (defined(LIBXML_THREAD_ENABLED)  LIBXML_VERSION = 20510)
+#if (defined(LIBXML_THREAD_ENABLED)  LIBXML_VERSION = 20511)
xmlThrDefSetGenericErrorFunc(xmlGenericErrorContext, 
(xmlGenericErrorFunc)domxml_error);
 #endif
 #if HAVE_DOMXSLT



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2003-12-02 Thread Rob Richards
rrichards   Tue Dec  2 10:09:36 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  Fix bug 26443: No errror reporting for Errors in the domxml extension
  
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.40 
php-src/ext/domxml/php_domxml.c:1.218.2.41
--- php-src/ext/domxml/php_domxml.c:1.218.2.40  Mon Dec  1 11:19:15 2003
+++ php-src/ext/domxml/php_domxml.c Tue Dec  2 10:09:31 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.40 2003/12/01 16:19:15 rrichards Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.41 2003/12/02 15:09:31 rrichards Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -1670,6 +1670,9 @@

REGISTER_LONG_CONSTANT(DOMXML_LOAD_COMPLETE_ATTRS,DOMXML_LOAD_COMPLETE_ATTRS,
 CONST_CS | CONST_PERSISTENT);

REGISTER_LONG_CONSTANT(DOMXML_LOAD_DONT_KEEP_BLANKS,DOMXML_LOAD_DONT_KEEP_BLANKS,
 CONST_CS | CONST_PERSISTENT);
xmlSetGenericErrorFunc(xmlGenericErrorContext, 
(xmlGenericErrorFunc)domxml_error);
+#if (defined(LIBXML_THREAD_ENABLED)  LIBXML_VERSION = 20510)
+   xmlThrDefSetGenericErrorFunc(xmlGenericErrorContext, 
(xmlGenericErrorFunc)domxml_error);
+#endif
 #if HAVE_DOMXSLT
xsltSetGenericErrorFunc(xsltGenericErrorContext, 
(xmlGenericErrorFunc)domxml_error);
 #if HAVE_DOMEXSLT

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2003-11-28 Thread Rob Richards
rrichards   Fri Nov 28 12:39:26 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  Fix for bug #26446: domxml_open_file() returns an empty error-Array
  
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.37 
php-src/ext/domxml/php_domxml.c:1.218.2.38
--- php-src/ext/domxml/php_domxml.c:1.218.2.37  Tue Nov 25 11:05:18 2003
+++ php-src/ext/domxml/php_domxml.c Fri Nov 28 12:39:25 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.37 2003/11/25 16:05:18 iliaa Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.38 2003/11/28 17:39:25 rrichards Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -4015,6 +4015,7 @@
ctxt-replaceEntities = substitute_ent;
 
if (data != NULL) {
+   ctxt-_private = data;
errorCtxt.valid = ctxt-vctxt;
errorCtxt.errors = data;
errorCtxt.parser = ctxt;   

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c /ext/domxml/tests bug26384.phpt

2003-11-28 Thread Christian Stocker
chregu  Fri Nov 28 19:43:39 2003 EDT

  Added files: (Branch: PHP_4_3)
/php-src/ext/domxml/tests   bug26384.phpt 

  Modified files:  
/php-src/ext/domxml php_domxml.c 
  Log:
  enhanced bug-26384-fix. It now only does an DocCopy, if xsl:key was
  found in xslt-document by default.
  
  
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.38 
php-src/ext/domxml/php_domxml.c:1.218.2.39
--- php-src/ext/domxml/php_domxml.c:1.218.2.38  Fri Nov 28 12:39:25 2003
+++ php-src/ext/domxml/php_domxml.c Fri Nov 28 19:43:37 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.38 2003/11/28 17:39:25 rrichards Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.39 2003/11/29 00:43:37 chregu Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -202,6 +202,7 @@
 zend_class_entry *domxsltstylesheet_class_entry;
 #endif
 
+static int xslt_has_xsl_keys (xmlDocPtr doc);
 
 static int node_attributes(zval **attributes, xmlNode *nodep TSRMLS_DC);
 static int node_children(zval **children, xmlNode *nodep TSRMLS_DC);
@@ -4724,6 +4725,21 @@
 /* }}} */
 #endif
 
+static int xslt_has_xsl_keys (xmlDocPtr doc) {
+   
+   xmlNode *nodep;
+   nodep = xmlDocGetRootElement(doc)-children;
+   while (nodep) {
+   if (nodep-type == XML_ELEMENT_NODE  xmlStrEqual(nodep-name, key) 
 xmlStrEqual(nodep-ns-href, XSLT_NAMESPACE)) {
+   return 1;
+   break;
+   }
+   nodep = nodep-next;
+   }
+   return 0;
+}
+
+
 /* {{{ int node_attributes(zval **attributes, int node)
Returns list of children nodes */
 static int node_attributes(zval **attributes, xmlNode *nodep TSRMLS_DC)
@@ -5382,7 +5398,7 @@
xmlDocPtr xmldocp;
xmlDocPtr docp;
char **params = NULL;
-   int ret, clone = 0;
+   int ret, clone = -1;
char *filename;
int filename_len = 0;
FILE *f;
@@ -5404,7 +5420,10 @@
}
 
DOMXML_GET_OBJ(xmldocp, idxml, le_domxmldocp);
-
+   if (clone == -1  xslt_has_xsl_keys(xsltstp-doc) == 1) {
+   clone = 1;
+   }
+   
if (idparams) {
params = php_domxslt_make_params(idparams, xpath_params TSRMLS_CC);
}

Index: php-src/ext/domxml/tests/bug26384.phpt
+++ php-src/ext/domxml/tests/bug26384.phpt

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2003-11-25 Thread Ilia Alshanetsky
iliaa   Tue Nov 25 11:05:19 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  Replace fopen() inside domxml_xslt_process() with streams code to prevent
  a possible crash and enforce safe_mode  open_basedir restrictions.
  
  Revert workaround for bug #26384, which is due to a bug in libxslt.
  Christian will commit a better workaround shortly.
  
  
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.36 
php-src/ext/domxml/php_domxml.c:1.218.2.37
--- php-src/ext/domxml/php_domxml.c:1.218.2.36  Mon Nov 24 21:19:47 2003
+++ php-src/ext/domxml/php_domxml.c Tue Nov 25 11:05:18 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.36 2003/11/25 02:19:47 iliaa Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.37 2003/11/25 16:05:18 iliaa Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -729,6 +729,7 @@
xmlDoc *doc = (xmlDoc *) rsrc-ptr;
 
if (doc) {
+   node_list_wrapper_dtor(doc-children, 1 TSRMLS_CC);
node_wrapper_dtor((xmlNodePtr) doc);
xmlFreeDoc(doc);
}
@@ -5383,6 +5384,7 @@
int ret, clone = 0;
char *filename;
int filename_len = 0;
+   FILE *f;
 
DOMXML_GET_THIS(idxsl);
 
@@ -5396,6 +5398,10 @@
RETURN_FALSE;
}
 
+   if (filename_len  !(f = php_stream_open_wrapper_as_file(filename, w, 
ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL))) {
+   RETURN_FALSE;
+   }
+
DOMXML_GET_OBJ(xmldocp, idxml, le_domxmldocp);
 
if (idparams) {
@@ -5407,8 +5413,6 @@
}
 
if (filename_len) {
-   FILE *f;
-   f = fopen (filename,w);
docp = xsltProfileStylesheet(xsltstp, xmldocp, (const char**)params, 
f);
fclose(f);
} else {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2003-11-22 Thread Rob Richards
rrichards   Sat Nov 22 09:43:09 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  fix default recovery mode
  
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.34 
php-src/ext/domxml/php_domxml.c:1.218.2.35
--- php-src/ext/domxml/php_domxml.c:1.218.2.34  Mon Oct 20 11:43:02 2003
+++ php-src/ext/domxml/php_domxml.c Sat Nov 22 09:43:08 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.34 2003/10/20 15:43:02 rrichards Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.35 2003/11/22 14:43:08 rrichards Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -3964,7 +3964,7 @@
domxml_ErrorCtxt errorCtxt;
char *directory = NULL;
int validate = 0, resolve_externals = 0;
-   int keep_blanks = 1, recovery = 1, substitute_ent;
+   int keep_blanks = 1, recovery = 0, substitute_ent;
 
substitute_ent = xmlSubstituteEntitiesDefaultValue;
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2003-10-20 Thread Rob Richards
rrichards   Mon Oct 20 11:43:03 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  Fix bug #25900 (document-get_elements_by_tag_name with default xmlns)
  
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.33 
php-src/ext/domxml/php_domxml.c:1.218.2.34
--- php-src/ext/domxml/php_domxml.c:1.218.2.33  Fri Oct 17 11:56:06 2003
+++ php-src/ext/domxml/php_domxml.c Mon Oct 20 11:43:02 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.33 2003/10/17 15:56:06 rrichards Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.34 2003/10/20 15:43:02 rrichards Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -3078,11 +3078,11 @@
DOMXML_GET_OBJ(contextnodep, contextnode, le_domxmlnodep);
}
ctxp-node = contextnodep;
-   str = (char*) emalloc((name_len+3) * sizeof(char)) ;
+   str = (char*) emalloc((name_len+23) * sizeof(char)) ;
if (str == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Cannot allocate memory 
for string);
}
-   sprintf(str ,//%s,name);
+   sprintf(str ,//*[local-name() = '%s'], name);
 
xpathobjp = xmlXPathEval(str, ctxp);
efree(str);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2003-10-17 Thread Rob Richards
rrichards   Fri Oct 17 11:56:07 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  Fix bug #25888 (Crash of php.exe when xpath_eval of a namespace)
  memleak fix in domxml_node_name
  keep blanks loading document fix
  
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.32 
php-src/ext/domxml/php_domxml.c:1.218.2.33
--- php-src/ext/domxml/php_domxml.c:1.218.2.32  Wed Sep 17 15:34:42 2003
+++ php-src/ext/domxml/php_domxml.c Fri Oct 17 11:56:06 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.32 2003/09/17 19:34:42 rrichards Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.33 2003/10/17 15:56:06 rrichards Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -160,6 +160,7 @@
 static int le_domxmlcommentp;
 static int le_domxmlnotationp;
 static int le_domxmlparserp;
+static int le_domxmlnamespacep;
 
 /*static int le_domxmlentityp;*/
 static int le_domxmlentityrefp;
@@ -513,6 +514,13 @@
 };
 
 static zend_function_entry php_domxmlns_class_functions[] = {
+   PHP_FALIAS(node_name,   domxml_node_name,  
 NULL)
+   PHP_FALIAS(node_type,   domxml_node_type,  
 NULL)
+   PHP_FALIAS(node_value,  domxml_node_value, 
 NULL)
+   PHP_FALIAS(prefix,  domxml_node_prefix,
 NULL)
+   PHP_FALIAS(namespace_uri,   domxml_node_namespace_uri, 
 NULL)
+   PHP_FALIAS(owner_document,  domxml_node_owner_document,
 NULL)
+   PHP_FALIAS(parent_node, domxml_node_parent,
 NULL)
{NULL, NULL, NULL}
 };
 
@@ -733,11 +741,19 @@
 
/* if node has no parent, it will not be freed by php_free_xml_doc, so do it 
here
and for all children as well. */
-   if (node-parent == NULL) {
+   if (node-parent == NULL || node-type == XML_NAMESPACE_DECL) {
/* Attribute Nodes ccontain accessible children 
attr_list_wrapper_dtor(node-properties); */
xmlSetTreeDoc(node, NULL);
-   node_list_wrapper_dtor((xmlNodePtr) node-properties, 1 TSRMLS_CC);
+   if (node-type == XML_NAMESPACE_DECL) {
+   if (node-ns) {
+   xmlFreeNs(node-ns);
+   node-ns = NULL;
+   }
+   node-type = XML_ELEMENT_NODE;
+   } else {
+   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);
@@ -1371,6 +1387,22 @@
break;
}
 
+   case XML_NAMESPACE_DECL:
+   {
+   xmlNodePtr nodep = obj;
+   if(!wrapper_in)
+   object_init_ex(wrapper, domxmlns_class_entry);
+   rsrc_type = le_domxmlnamespacep;
+   add_property_long(wrapper, type, Z_TYPE_P(nodep));
+   add_property_stringl(wrapper, name, (char *) nodep-name, 
strlen(nodep-name), 1);
+   content = xmlNodeGetContent(nodep-children);
+   if (content) {
+   add_property_stringl(wrapper, value, (char *) 
content, strlen(content), 1);
+   xmlFree(content);
+   }
+   break;
+   }
+
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, Unsupported node 
type: %d\n, Z_TYPE_P(obj));
FREE_ZVAL(wrapper);
@@ -1508,6 +1540,7 @@
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_domxmlnamespacep = zend_register_list_destructors_ex(php_free_xml_node, 
NULL, domnamespacenode, 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.
@@ -1890,6 +1923,7 @@
zval *id;
xmlNode *n;
int fullQName = 0;
+   xmlChar *qname = NULL;
const char *str = NULL;
 
DOMXML_PARAM_ONE(n, id, 

[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2003-09-17 Thread Rob Richards
rrichards   Wed Sep 17 15:34:43 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  fix some threading issues
  fix mem leaks in append_child with attribute nodes
  Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.31 
php-src/ext/domxml/php_domxml.c:1.218.2.32
--- php-src/ext/domxml/php_domxml.c:1.218.2.31  Tue Sep  9 15:43:44 2003
+++ php-src/ext/domxml/php_domxml.c Wed Sep 17 15:34:42 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.31 2003/09/09 19:43:44 msopacua Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.32 2003/09/17 19:34:42 rrichards Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -146,6 +146,8 @@
 #define DOMXML_LOAD_SUBSTITUTE_ENTITIES 4
 #define DOMXML_LOAD_COMPLETE_ATTRS 8
 #define DOMXML_LOAD_DONT_KEEP_BLANKS 16
+#define DOMXML_LOAD_FILE 1
+
 static int le_domxmldocp;
 static int le_domxmldoctypep;
 static int le_domxmldtdp;
@@ -170,7 +172,6 @@
 static void domxml_error(void *ctx, const char *msg, ...);
 static void domxml_error_ext(void *ctx, const char *msg, ...);
 static void domxml_error_validate(void *ctx, const char *msg, ...);
-static xmlDocPtr php_dom_xmlSAXParse(xmlSAXHandlerPtr sax, const char *buffer, int 
size, int recovery, void *data);
 
 #if defined(LIBXML_XPATH_ENABLED)
 static int le_xpathctxp;
@@ -1477,73 +1478,13 @@

 }
 
-static xmlDocPtr php_dom_xmlSAXParse(xmlSAXHandlerPtr sax, const char *buffer, int 
size, int recovery, void *data)
-{
-xmlDocPtr ret;
-xmlParserCtxtPtr ctxt;
-domxml_ErrorCtxt errorCtxt;
-char *directory = NULL;
-
-xmlInitParser();
-/*if size == -1, we assume, it's a filename not a inmemory xml doc*/
-if (size == -1) {
-   ctxt = (xmlParserCtxt *) xmlCreateFileParserCtxt( buffer);
-} else {
-   ctxt = (xmlParserCtxt *) xmlCreateMemoryParserCtxt((xmlChar *) buffer, 
size);
-}
-if (ctxt == NULL) {
-   return(NULL);
-}
-   if (sax != NULL) {
-   if (ctxt-sax != NULL)
-   xmlFree(ctxt-sax);
-   ctxt-sax = sax;
-   }
-   if (data!=NULL) {
-   ctxt-_private=data;
-   }
-
-/* store directory name */
-   if (size == -1) {
-   if ((ctxt-directory == NULL)  (directory == NULL))
-   directory = xmlParserGetDirectory(buffer);
-   if ((ctxt-directory == NULL)  (directory != NULL))
-   ctxt-directory = (char *) xmlStrdup((xmlChar *) directory);
-   }
-   errorCtxt.valid = ctxt-vctxt;
-   errorCtxt.errors = data;
-   errorCtxt.parser = ctxt;   
-
-   ctxt-sax-error = domxml_error_ext;
-   ctxt-sax-warning = domxml_error_ext;
-   ctxt-vctxt.userData= (void *) errorCtxt;
-   ctxt-vctxt.error= (xmlValidityErrorFunc) domxml_error_validate;
-   ctxt-vctxt.warning  = (xmlValidityWarningFunc) domxml_error_validate; 
-
-   xmlParseDocument(ctxt);
-
-   if ((ctxt-wellFormed) || recovery) {
-   ret = ctxt-myDoc;
-   } else {
-   ret = NULL;
-   xmlFreeDoc(ctxt-myDoc);
-   ctxt-myDoc = NULL;
-   }
-if (sax != NULL)
-ctxt-sax = NULL;
-
-   xmlFreeParserCtxt(ctxt);
-
-   return(ret);
-}
-
 PHP_MSHUTDOWN_FUNCTION(domxml)
 {
 #if HAVE_DOMXSLT
xsltCleanupGlobals();
 #endif
xmlCleanupParser();
-   
+
 /* If you want do find memleaks in this module, compile libxml2 with 
--with-mem-debug and
uncomment the following line, this will tell you the amount of not freed memory
and the total used memory into apaches error_log  */
@@ -2472,20 +2413,37 @@
foundattrp = xmlHasProp(parent, child-name);
else
foundattrp = xmlHasNsProp(parent, child-name, 
child-ns-href);
-   if ((foundattrp != NULL)  (foundattrp != (xmlAttrPtr) 
child)) {
-   xmlUnlinkNode((xmlNodePtr) foundattrp);
-   (void)xmlCopyProp(parent, (xmlAttrPtr) child);
-   /* We're in the dark here, what happened to the 
parent, let's
-* assume it's handled properly and return the new(?) 
parent
-*/
-   new_child = parent;
+   if (foundattrp != (xmlAttrPtr) child) {
+   if (foundattrp != NULL) {
+   if (dom_object_get_data((xmlNodePtr) 
foundattrp) == NULL) {
+   node_list_unlink(foundattrp-children);
+   xmlUnlinkNode((xmlNodePtr) foundattrp);
+   xmlFreeProp(foundattrp);
+   

[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2003-08-29 Thread Rob Richards
rrichards   Fri Aug 29 11:29:25 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  workaround for bug #25268. libxslt issue with xsl:key
  
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.28 
php-src/ext/domxml/php_domxml.c:1.218.2.29
--- php-src/ext/domxml/php_domxml.c:1.218.2.28  Thu Aug  7 12:44:11 2003
+++ php-src/ext/domxml/php_domxml.c Fri Aug 29 11:29:24 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.28 2003/08/07 16:44:11 zeev Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.29 2003/08/29 15:29:24 rrichards Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -5349,7 +5349,7 @@
xmlDocPtr xmldocp;
xmlDocPtr docp;
char **params = NULL;
-   int ret;
+   int ret, clone = 0;
char *filename;
int filename_len = 0;
 
@@ -5361,7 +5361,7 @@
RETURN_FALSE;
}
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, o|abs, idxml, 
idparams, xpath_params, filename, filename_len) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, o|a!b!s!l, idxml, 
idparams, xpath_params, filename, filename_len, clone) == FAILURE) {
RETURN_FALSE;
}
 
@@ -5371,6 +5371,10 @@
params = php_domxslt_make_params(idparams, xpath_params TSRMLS_CC);
}
 
+   if (clone == 1) {
+   xmldocp = xmlCopyDoc(xmldocp, 1);
+   }
+
if (filename_len) {
FILE *f;
f = fopen (filename,w);
@@ -5378,6 +5382,10 @@
fclose(f);
} else {
docp = xsltApplyStylesheet(xsltstp, xmldocp, (const char**)params);
+   }
+
+   if (clone == 1) {
+   xmlFreeDoc(xmldocp);
}
 
if (params) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c /ext/snmp snmp.c

2003-08-14 Thread Zeev Suraski
zeevThu Aug  7 12:44:11 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
/php-src/ext/snmp   snmp.c 
  Log:
  Remove 'proto' from internal functions
  
  
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.27 
php-src/ext/domxml/php_domxml.c:1.218.2.28
--- php-src/ext/domxml/php_domxml.c:1.218.2.27  Fri Jul 25 08:45:05 2003
+++ php-src/ext/domxml/php_domxml.c Thu Aug  7 12:44:11 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.27 2003/07/25 12:45:05 sniper Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.28 2003/08/07 16:44:11 zeev Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -4716,9 +4716,7 @@
 /* }}} */
 #endif
 
-/* We don't have a type zval. **attributes is also very unusual. */
-
-/* {{{ proto int node_attributes(zval **attributes, int node)
+/* {{{ int node_attributes(zval **attributes, int node)
Returns list of children nodes */
 static int node_attributes(zval **attributes, xmlNode *nodep TSRMLS_DC)
 {
Index: php-src/ext/snmp/snmp.c
diff -u php-src/ext/snmp/snmp.c:1.70.2.10 php-src/ext/snmp/snmp.c:1.70.2.11
--- php-src/ext/snmp/snmp.c:1.70.2.10   Fri Jul 25 03:32:39 2003
+++ php-src/ext/snmp/snmp.c Thu Aug  7 12:44:11 2003
@@ -20,7 +20,7 @@
   +--+
 */
 
-/* $Id: snmp.c,v 1.70.2.10 2003/07/25 07:32:39 harrie Exp $ */
+/* $Id: snmp.c,v 1.70.2.11 2003/08/07 16:44:11 zeev Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -703,7 +703,7 @@
 }
 /* }}} */
 
-/* {{{ proto int netsnmp_session_set_sec_name(struct snmp_session *s, char *name)
+/* {{{ int netsnmp_session_set_sec_name(struct snmp_session *s, char *name)
Set the security name in the snmpv3 session */
 static int netsnmp_session_set_sec_name(struct snmp_session *s, char *name)
 {
@@ -716,7 +716,7 @@
 }
 /* }}} */
 
-/* {{{ proto int netsnmp_session_set_sec_level(struct snmp_session *s, char *level)
+/* {{{ int netsnmp_session_set_sec_level(struct snmp_session *s, char *level)
Set the security level in the snmpv3 session */
 static int netsnmp_session_set_sec_level(struct snmp_session *s, char *level 
TSRMLS_DC)
 {
@@ -737,7 +737,7 @@
 }
 /* }}} */
 
-/* {{{ proto int netsnmp_session_set_auth_protocol(struct snmp_session *s, char *prot)
+/* {{{ int netsnmp_session_set_auth_protocol(struct snmp_session *s, char *prot)
Set the authentication protocol in the snmpv3 session */
 static int netsnmp_session_set_auth_protocol(struct snmp_session *s, char *prot 
TSRMLS_DC)
 {
@@ -758,7 +758,7 @@
 }
 /* }}} */
 
-/* {{{ proto int netsnmp_session_set_sec_protocol(struct snmp_session *s, char *prot)
+/* {{{ int netsnmp_session_set_sec_protocol(struct snmp_session *s, char *prot)
Set the security protocol in the snmpv3 session */
 static int netsnmp_session_set_sec_protocol(struct snmp_session *s, char *prot 
TSRMLS_DC)
 {
@@ -789,7 +789,7 @@
 }
 /* }}} */
 
-/* {{{ proto int netsnmp_session_gen_auth_key(struct snmp_session *s, char *pass)
+/* {{{ int netsnmp_session_gen_auth_key(struct snmp_session *s, char *pass)
Make key from pass phrase in the snmpv3 session */
 static int netsnmp_session_gen_auth_key(struct snmp_session *s, char *pass TSRMLS_DC)
 {
@@ -821,7 +821,7 @@
 }
 /* }}} */
 
-/* {{{ proto int netsnmp_session_gen_sec_key(struct snmp_session *s, u_char *pass)
+/* {{{ int netsnmp_session_gen_sec_key(struct snmp_session *s, u_char *pass)
Make key from pass phrase in the snmpv3 session */
 static int netsnmp_session_gen_sec_key(struct snmp_session *s, u_char *pass TSRMLS_DC)
 {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2003-07-25 Thread Jani Taskinen
sniper  Fri Jul 25 08:45:05 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  some missing static with internal funcs.
  
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.26 
php-src/ext/domxml/php_domxml.c:1.218.2.27
--- php-src/ext/domxml/php_domxml.c:1.218.2.26  Wed Jul 23 12:44:27 2003
+++ php-src/ext/domxml/php_domxml.c Fri Jul 25 08:45:05 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.26 2003/07/23 16:44:27 iliaa Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.27 2003/07/25 12:45:05 sniper Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -818,7 +818,7 @@
}
 }
 
-void *php_xsltstylesheet_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 
TSRMLS_DC)
+static void *php_xsltstylesheet_get_object(zval *wrapper, int rsrc_type1, int 
rsrc_type2 TSRMLS_DC)
 {
void *obj;
zval **handle;
@@ -867,8 +867,9 @@
 }
 #endif  /* HAVE_DOMXSLT */
 
-
-void *php_xpath_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC)
+/* Not used? */
+/*
+static void *php_xpath_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 
TSRMLS_DC)
 {
void *obj;
zval **handle;
@@ -897,6 +898,7 @@
 
return obj;
 }
+*/
 
 static zval *php_xpathobject_new(xmlXPathObjectPtr obj, int *found TSRMLS_DC)
 {
@@ -907,7 +909,7 @@
return (wrapper);
 }
 
-void *php_xpath_get_context(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC)
+static void *php_xpath_get_context(zval *wrapper, int rsrc_type1, int rsrc_type2 
TSRMLS_DC)
 {
void *obj;
zval **handle;
@@ -1101,7 +1103,7 @@
 /* }}} */
 /* end parser stuff */
 
-void *php_dom_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC)
+static void *php_dom_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 
TSRMLS_DC)
 {
void *obj;
zval **handle;
@@ -1475,8 +1477,8 @@

 }
 
-xmlDocPtr php_dom_xmlSAXParse(xmlSAXHandlerPtr sax, const char *buffer, int size, int 
recovery, void *data) {
-
+static xmlDocPtr php_dom_xmlSAXParse(xmlSAXHandlerPtr sax, const char *buffer, int 
size, int recovery, void *data)
+{
 xmlDocPtr ret;
 xmlParserCtxtPtr ctxt;
 domxml_ErrorCtxt errorCtxt;
@@ -3118,7 +3120,8 @@
xmlNode *element;
 };
 
-static void idsHashScanner(void *payload, void *data, xmlChar *name) {
+static void idsHashScanner(void *payload, void *data, xmlChar *name)
+{
idsIterator *priv = (idsIterator *)data;
 
if (priv-element == NULL  xmlStrEqual (name, priv-elementId))



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/domxml php_domxml.c

2003-07-23 Thread Ilia Alshanetsky
iliaa   Wed Jul 23 12:44:27 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/domxml php_domxml.c 
  Log:
  MFH: Fixed #24609 (segfault when using replace node across different docs)
  Patch by: Rob Richards
  
  # This patch somehow did not make it into 4.3.X, so on Rob's request in am
  # MFHing it in.
  
  
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.25 
php-src/ext/domxml/php_domxml.c:1.218.2.26
--- php-src/ext/domxml/php_domxml.c:1.218.2.25  Wed Jun 18 13:43:34 2003
+++ php-src/ext/domxml/php_domxml.c Wed Jul 23 12:44:27 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.218.2.25 2003/06/18 17:43:34 rrichards Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.26 2003/07/23 16:44:27 iliaa Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -2384,6 +2384,7 @@
 {
zval *id, *rv = NULL, *node;
xmlNodePtr repnode, nodep, old_repnode;
+   xmlDocPtr tmpdoc;
int ret;
 
DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
@@ -2394,7 +2395,17 @@
 
DOMXML_GET_OBJ(repnode, node, le_domxmlnodep);
 
+   tmpdoc = repnode-doc;
+
old_repnode = xmlReplaceNode(nodep, repnode);
+
+   /* ReplaceNode will change the doc for only the first node 
+   so check if doc was changed */
+   if (tmpdoc != repnode-doc) {
+   /* Set doc back to old doc otherwise libxml wont change all sub nodes 
*/
+   repnode-doc = tmpdoc;
+   xmlSetTreeDoc(repnode, old_repnode-doc);
+   }
 
DOMXML_RET_OBJ(rv, old_repnode, ret);
 }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php