We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ec6713f commit e6e2c1cCopy full SHA for e6e2c1c
ext/standard/string.c
@@ -3582,8 +3582,8 @@ PHP_FUNCTION(str_repeat)
3582
result_len = Z_STRLEN_PP(input_str) * Z_LVAL_PP(mult);
3583
result = (char *)emalloc(result_len + 1);
3584
3585
- /* Heavy optimization for situations where multiplier is 1 byte long */
3586
- if (Z_LVAL_PP(mult) == 1) {
+ /* Heavy optimization for situations where input string is 1 byte long */
+ if (Z_STRLEN_PP(input_str) == 1) {
3587
memset(result, *(Z_STRVAL_PP(input_str)), Z_LVAL_PP(mult));
3588
} else {
3589
char *s, *e, *ee;
0 commit comments