From: Rob Richards Date: Thu, 29 Jan 2004 00:33:20 +0000 (+0000) Subject: fix corruption when cloneDocument is not defined X-Git-Tag: php-5.0.0b4RC1~242 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=109ea548713a88d74ce883c888b80d6a848f38fb;p=php fix corruption when cloneDocument is not defined --- diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index d02682e98f..37358d01be 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -297,7 +297,7 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet) xsltStylesheetPtr sheetp, oldsheetp; xsl_object *intern; php_libxml_node_object *docobj; - int prevSubstValue, prevExtDtdValue, clone_docu; + int prevSubstValue, prevExtDtdValue, clone_docu = 0; xmlNode *nodep; zend_object_handlers *std_hnd; zval *cloneDocu, *member; @@ -333,9 +333,11 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet) MAKE_STD_ZVAL(member); ZVAL_STRING(member, "cloneDocument", 0); cloneDocu = std_hnd->read_property(id, member, 1 TSRMLS_CC); - convert_to_long(cloneDocu); + if (Z_TYPE_P(cloneDocu) != IS_NULL) { + convert_to_long(cloneDocu); + clone_docu = Z_LVAL_P(cloneDocu); + } efree(member); - clone_docu = Z_LVAL_P(cloneDocu); if (clone_docu == 0) { /* check if the stylesheet is using xsl:key, if yes, we have to clone the document _always_ before a transformation */ nodep = xmlDocGetRootElement(sheetp->doc)->children;