- Implemented the strtolower function.
authorDerick Rethans <github@derickrethans.nl>
Wed, 29 Jun 2011 11:42:34 +0000 (12:42 +0100)
committerDerick Rethans <github@derickrethans.nl>
Wed, 29 Jun 2011 11:42:34 +0000 (12:42 +0100)
twig.c

diff --git a/twig.c b/twig.c
index e1b3f84..6e0dc83 100644 (file)
--- a/twig.c
+++ b/twig.c
@@ -168,8 +168,16 @@ int TWIG_CALL_BOOLEAN(zval *property, char *functionName)
 
 }
 
-char *TWIG_STRTOLOWER(zval *item)
+char *TWIG_STRTOLOWER_ZVAL(zval *item)
 {
+       char *item_dup;
+
+       if (Z_TYPE_P(item) != IS_STRING) {
+               return NULL;
+       }
+       item_dup = estrndup(Z_STRVAL_P(item), Z_STRLEN_P(item));
+       php_strtolower(item_dup, Z_STRLEN_P(item));
+       return item_dup;
 }
 
 zval *TWIG_CALL_USER_FUNC_ARRAY(zval *object, char *function, zval *arguments)