summaryrefslogtreecommitdiff
path: root/ext/domxml/php_domxml.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/domxml/php_domxml.c')
-rw-r--r--ext/domxml/php_domxml.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c
index 1a17c63337..ada6127a9d 100644
--- a/ext/domxml/php_domxml.c
+++ b/ext/domxml/php_domxml.c
@@ -5349,7 +5349,7 @@ PHP_FUNCTION(domxml_xslt_process)
xmlDocPtr xmldocp;
xmlDocPtr docp;
char **params = NULL;
- int ret;
+ int ret, clone = 0;
char *filename;
int filename_len = 0;
@@ -5361,7 +5361,7 @@ PHP_FUNCTION(domxml_xslt_process)
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 @@ PHP_FUNCTION(domxml_xslt_process)
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");
@@ -5380,6 +5384,10 @@ PHP_FUNCTION(domxml_xslt_process)
docp = xsltApplyStylesheet(xsltstp, xmldocp, (const char**)params);
}
+ if (clone == 1) {
+ xmlFreeDoc(xmldocp);
+ }
+
if (params) {
efree(params);
}