1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 11:13:36 +02:00

Fixed a bug in the new implementation of str_repeat()

This commit is contained in:
Sander Roobol
2002-10-04 17:10:51 +00:00
parent ec6713f1ca
commit e6e2c1c70d
+2 -2
View File
@@ -3582,8 +3582,8 @@ PHP_FUNCTION(str_repeat)
result_len = Z_STRLEN_PP(input_str) * Z_LVAL_PP(mult);
result = (char *)emalloc(result_len + 1);
/* Heavy optimization for situations where multiplier is 1 byte long */
if (Z_LVAL_PP(mult) == 1) {
/* Heavy optimization for situations where input string is 1 byte long */
if (Z_STRLEN_PP(input_str) == 1) {
memset(result, *(Z_STRVAL_PP(input_str)), Z_LVAL_PP(mult));
} else {
char *s, *e, *ee;