From 50da1a288107ca82cfd5022c218cfa5dcda3fa6e Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Sat, 10 Dec 2011 14:48:20 +0100 Subject: [PATCH] don't modify function name --- ext/twig/twig.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ext/twig/twig.c b/ext/twig/twig.c index bd51d49..90f87cd 100644 --- a/ext/twig/twig.c +++ b/ext/twig/twig.c @@ -619,6 +619,7 @@ static int twig_add_method_to_class(void *pDest TSRMLS_DC, int num_args, va_list { zval *retval; char *item; + size_t item_len; zend_function *mptr = (zend_function *) pDest; if ( ! (mptr->common.fn_flags & ZEND_ACC_PUBLIC ) ) { @@ -626,9 +627,12 @@ static int twig_add_method_to_class(void *pDest TSRMLS_DC, int num_args, va_list } retval = va_arg(args, zval*); - item = php_strtolower(mptr->common.function_name, strlen(mptr->common.function_name)); - add_assoc_string(retval, item, item, 1); + item_len = strlen(mptr->common.function_name); + item = estrndup(mptr->common.function_name, item_len); + php_strtolower(item, item_len); + + add_assoc_stringl_ex(retval, item, item_len+1, item, item_len, 0); return 0; } -- 1.7.2.5