From 7732ce7fe332c37430e6fb539a3d64f05cfc38be Mon Sep 17 00:00:00 2001 From: Melvyn Sopacua Date: Thu, 21 Nov 2002 23:28:26 +0000 Subject: [PATCH] Fix bug #20518 --- ext/xslt/php_sablot.h | 2 ++ ext/xslt/sablot.c | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ext/xslt/php_sablot.h b/ext/xslt/php_sablot.h index 6205193715..afa3eedc54 100644 --- a/ext/xslt/php_sablot.h +++ b/ext/xslt/php_sablot.h @@ -46,6 +46,7 @@ extern zend_module_entry xslt_module_entry; #define XSLT_ERRNO(handle) ((handle)->err->no) #define XSLT_ERRSTR(handle) ((handle)->err->str) #define XSLT_LOG(handle) ((handle)->err->log) +#define XSLT_BASE_ISSET(handle) ((handle)->base_isset) #define XSLT_FUNCH_FREE(__var) if (__var) zval_ptr_dtor(&(__var)); #define XSLT_REG_ERRMSG(msg, handle) if (XSLT_ERRSTR(handle)) efree(XSLT_ERRSTR(handle)); \ @@ -124,6 +125,7 @@ typedef struct { struct xslt_processor processor; struct xslt_error *err; zval *object; + unsigned short base_isset; } php_xslt; #else diff --git a/ext/xslt/sablot.c b/ext/xslt/sablot.c index f55003757e..ba1db3fdf9 100644 --- a/ext/xslt/sablot.c +++ b/ext/xslt/sablot.c @@ -218,6 +218,7 @@ PHP_FUNCTION(xslt_create) handle->handlers = ecalloc(1, sizeof(struct xslt_handlers)); handle->err = ecalloc(1, sizeof(struct xslt_error)); handle->object = NULL; + handle->base_isset = 0; XSLT_LOG(handle).path = NULL; @@ -435,6 +436,7 @@ PHP_FUNCTION(xslt_set_base) /* Set the base */ SablotSetBase(XSLT_PROCESSOR(handle), Z_STRVAL_PP(base)); + XSLT_BASE_ISSET(handle) = 1; } /* }}} */ @@ -547,7 +549,6 @@ PHP_FUNCTION(xslt_process) xslt_make_array(args_p, &args); /* Can return NULL */ if (args) { - char *baseuri; TSRMLS_FETCH(); i=0; while (args[i]) { @@ -559,14 +560,17 @@ PHP_FUNCTION(xslt_process) } /* Since we have args passed, we need to set the base uri, so pull in executor - globals and set the base, using the current filename, specifally for the + globals and set the base, using the current filename, specifcally for the 'arg' scheme */ + if(XSLT_BASE_ISSET(handle) == 0) + { + char *baseuri; spprintf(&baseuri, 0, "file://%s", zend_get_executed_filename(TSRMLS_C)); + SablotSetBaseForScheme(XSLT_PROCESSOR(handle), "arg", baseuri); - SablotSetBaseForScheme(XSLT_PROCESSOR(handle), "arg", baseuri); - - if(baseuri) - efree(baseuri); + if(baseuri) + efree(baseuri); + } } } -- 2.40.0