]> granicus.if.org Git - php/commitdiff
Fixed str_repeat() bug
authorDmitry Stogov <dmitry@php.net>
Fri, 12 Aug 2005 13:41:15 +0000 (13:41 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 12 Aug 2005 13:41:15 +0000 (13:41 +0000)
ext/standard/string.c

index 4ae9a65a73a41890c168dce51ac71f8013e4fae2..96eedb6fc7542a24ae17f79a82648ed667b7e56a 100644 (file)
@@ -4740,13 +4740,13 @@ PHP_FUNCTION(str_repeat)
        
        if ( input_str_type == IS_UNICODE ) {
                *(((UChar *)result)+result_chars-1) = 0;
-               RETURN_UNICODEL((UChar *)result, result_chars, 0);
+               RETURN_UNICODEL((UChar *)result, result_chars-1, 0);
        } else {
                *(((char *)result)+result_chars-1) = '\0';
                if ( input_str_type == IS_BINARY ) {
-                       RETURN_BINARYL((char *)result, result_chars, 0);
+                       RETURN_BINARYL((char *)result, result_chars-1, 0);
                } else {
-                       RETURN_STRINGL((char *)result, result_chars, 0);
+                       RETURN_STRINGL((char *)result, result_chars-1, 0);
                }
        }
 }