From: Xinchen Hui Date: Mon, 26 Feb 2018 08:48:49 +0000 (+0800) Subject: Avoding memory allocation X-Git-Tag: php-7.3.0alpha1~300 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd88e7e3a1638d3f5b8661b63de44aeee755325a;p=php Avoding memory allocation --- diff --git a/ext/standard/string.c b/ext/standard/string.c index 12e91dc112..969b56e9e4 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -5654,7 +5654,7 @@ PHP_FUNCTION(str_pad) /* If resulting string turns out to be shorter than input string, we simply copy the input and return. */ if (pad_length < 0 || (size_t)pad_length <= ZSTR_LEN(input)) { - RETURN_STRINGL(ZSTR_VAL(input), ZSTR_LEN(input)); + RETURN_STR_COPY(input); } if (pad_str_len == 0) {