diff options
author | Rob Richards <rrichards@php.net> | 2003-08-20 17:58:55 +0000 |
---|---|---|
committer | Rob Richards <rrichards@php.net> | 2003-08-20 17:58:55 +0000 |
commit | 20a878dc60db10d9b9d9d5739cbd82eb4cd21fc0 (patch) | |
tree | f4add9c01e3a76e58bab0c956e8eb7361573b32a | |
parent | ece0a731e9d66f7ea9871df771074a2b3eba76e3 (diff) | |
download | php-git-20a878dc60db10d9b9d9d5739cbd82eb4cd21fc0.tar.gz |
doc must be copied when importing stylesheet
libxslt uses the _private for processing
-rw-r--r-- | ext/xsl/xsltprocessor.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index dcdbc98852..27d22fef05 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -124,7 +124,7 @@ Since: 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 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet) 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 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet) 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); } |