rrichards               Tue Dec  9 15:12:40 2003 EDT

  Modified files:              
    /php-src/ext/xsl    php_xsl.c 
  Log:
  fix issues when passing in mulitple arguments
  
Index: php-src/ext/xsl/php_xsl.c
diff -u php-src/ext/xsl/php_xsl.c:1.14 php-src/ext/xsl/php_xsl.c:1.15
--- php-src/ext/xsl/php_xsl.c:1.14      Sat Nov 29 15:40:54 2003
+++ php-src/ext/xsl/php_xsl.c   Tue Dec  9 15:12:39 2003
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: php_xsl.c,v 1.14 2003/11/29 20:40:54 rrichards Exp $ */
+/* $Id: php_xsl.c,v 1.15 2003/12/09 20:12:39 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -176,8 +176,12 @@
                return;
        }
 
-       args = safe_emalloc(sizeof(zval **), nargs - 1, 0);
-       for (i = 0; i < nargs - 1; i++) {
+       fci.param_count = nargs - 1;
+       fci.params = safe_emalloc(fci.param_count, sizeof(zval**), 0);
+
+       args = safe_emalloc(nargs - 1, sizeof(zval *), 0);
+       /* Reverse order to pop values off ctxt stack */
+       for (i = nargs - 2; i >= 0; i--) {
                obj = valuePop(ctxt);
                MAKE_STD_ZVAL(args[i]);
                switch (obj->type) {
@@ -236,6 +240,7 @@
                        ZVAL_STRING(args[i], "", 0);
                }
                xmlXPathFreeObject(obj);
+               fci.params[i] = &args[i];
        }
        
        fci.size = sizeof(fci);
@@ -250,8 +255,6 @@
        fci.symbol_table = NULL;
        fci.object_pp = NULL;
        fci.retval_ptr_ptr = &retval;
-       fci.param_count = nargs - 1;
-       fci.params = &args;
        fci.no_separation = 0;
        /*fci.function_handler_cache = &function_ptr;*/
        
@@ -280,6 +283,7 @@
                zval_ptr_dtor(&args[i]);
        }
        efree(args);
+       efree(fci.params);
 }
 
 static void xsl_ext_function_string_php(xmlXPathParserContextPtr ctxt, int nargs)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to