rrichards               Wed Aug 20 13:58:56 2003 EDT

  Modified files:              
    /php-src/ext/xsl    xsltprocessor.c 
  Log:
  doc must be copied when importing stylesheet
  libxslt uses the _private for processing
  
Index: php-src/ext/xsl/xsltprocessor.c
diff -u php-src/ext/xsl/xsltprocessor.c:1.10 php-src/ext/xsl/xsltprocessor.c:1.11
--- php-src/ext/xsl/xsltprocessor.c:1.10        Mon Aug 11 20:55:55 2003
+++ php-src/ext/xsl/xsltprocessor.c     Wed Aug 20 13:58:55 2003
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: xsltprocessor.c,v 1.10 2003/08/12 00:55:55 iliaa Exp $ */
+/* $Id: xsltprocessor.c,v 1.11 2003/08/20 17:58:55 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -124,7 +124,7 @@
 PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
 {
        zval *id, *docp = NULL;
-       xmlDoc *doc = NULL;
+       xmlDoc *doc = NULL, *newdoc = NULL;
        xsltStylesheetPtr sheetp, oldsheetp;
        xsl_object *intern;
        node_object *docobj;
@@ -137,7 +137,11 @@
 
        DOC_GET_OBJ(doc, docp, xmlDocPtr, docobj);
 
-       sheetp = xsltParseStylesheetDoc(doc);
+       /* libxslt uses _private, so we must copy the imported 
+       stylesheet document otherwise the node proxies will be a mess */
+       newdoc = xmlCopyDoc(doc, 1);
+
+       sheetp = xsltParseStylesheetDoc(newdoc);
 
        if (!sheetp) {
                RETURN_FALSE;
@@ -161,8 +165,9 @@
                intern->ptr = NULL;
        }
 
-       intern->document = docobj->document;
-       intern->document->refcount++;
+       intern->document = emalloc(sizeof(dom_ref_obj));
+       intern->document->ptr = newdoc;
+       intern->document->refcount = 1;
 
        php_xsl_set_object(id, sheetp TSRMLS_CC);
 }



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

Reply via email to