From c23ec177d5e16ca43ae69589a76b43500a66548a Mon Sep 17 00:00:00 2001 From: Rob Richards Date: Fri, 29 Aug 2003 15:29:24 +0000 Subject: [PATCH] workaround for bug #25268. libxslt issue with xsl:key --- ext/domxml/php_domxml.c | 12 ++++++++++-- 1 file 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); } -- 2.50.1