Skip to content

Commit e6e2c1c

Browse files
author
Sander Roobol
committed
Fixed a bug in the new implementation of str_repeat()
1 parent ec6713f commit e6e2c1c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/standard/string.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3582,8 +3582,8 @@ PHP_FUNCTION(str_repeat)
35823582
result_len = Z_STRLEN_PP(input_str) * Z_LVAL_PP(mult);
35833583
result = (char *)emalloc(result_len + 1);
35843584

3585-
/* Heavy optimization for situations where multiplier is 1 byte long */
3586-
if (Z_LVAL_PP(mult) == 1) {
3585+
/* Heavy optimization for situations where input string is 1 byte long */
3586+
if (Z_STRLEN_PP(input_str) == 1) {
35873587
memset(result, *(Z_STRVAL_PP(input_str)), Z_LVAL_PP(mult));
35883588
} else {
35893589
char *s, *e, *ee;

0 commit comments

Comments
 (0)