]> granicus.if.org Git - php/commitdiff
Fixed strtolower/strtoupper to not modify the passed argument
authorDmitry Stogov <dmitry@php.net>
Tue, 24 Jun 2008 06:07:08 +0000 (06:07 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 24 Jun 2008 06:07:08 +0000 (06:07 +0000)
ext/standard/string.c

index 916f9e15a7b1ff5dcb722d141cf3c26b89db20a7..142e1f4ace7743cc8f11499633b818f7ed07b285 100644 (file)
@@ -1291,9 +1291,9 @@ PHP_FUNCTION(strtoupper)
                return;
        }
 
-       php_strtoupper(arg, arglen);
-       
-       RETURN_STRINGL(arg, arglen, 1);
+       arg = estrndup(arg, arglen);
+       php_strtoupper(arg, arglen);    
+       RETURN_STRINGL(arg, arglen, 0);
 }
 /* }}} */
 
@@ -1325,8 +1325,9 @@ PHP_FUNCTION(strtolower)
                return;
        }
 
+       str = estrndup(str, arglen);
        php_strtolower(str, arglen);
-       RETURN_STRINGL(str, arglen, 1);
+       RETURN_STRINGL(str, arglen, 0);
 }
 /* }}} */