]> granicus.if.org Git - php/commitdiff
Fix bug #20518
authorMelvyn Sopacua <msopacua@php.net>
Thu, 21 Nov 2002 23:28:26 +0000 (23:28 +0000)
committerMelvyn Sopacua <msopacua@php.net>
Thu, 21 Nov 2002 23:28:26 +0000 (23:28 +0000)
ext/xslt/php_sablot.h
ext/xslt/sablot.c

index 620519371502424c4da48b2af9709a31592774b2..afa3eedc542f88bf2f62850a01fa953dae0fb6f9 100644 (file)
@@ -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
index f55003757e2afd1a5e5349a9a8291846a6bea2db..ba1db3fdf994b3e430428f2ba7c84b70701fafa6 100644 (file)
@@ -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);
+                       }
                }
        }