From: Jani Taskinen Date: Mon, 23 Jul 2007 13:27:59 +0000 (+0000) Subject: MFH: Fixed str_pad() when passed huge negative pad length. X-Git-Tag: php-5.2.4RC1~74 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e8fcd7477c029f1bad4cb4f1e08d7be674b0d825;p=php MFH: Fixed str_pad() when passed huge negative pad length. --- diff --git a/ext/standard/string.c b/ext/standard/string.c index cb8fa70ca3..4436b5a7aa 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -4746,7 +4746,7 @@ PHP_FUNCTION(str_pad) /* If resulting string turns out to be shorter than input string, we simply copy the input and return. */ - if (num_pad_chars < 0) { + if (Z_LVAL_PP(pad_length) < 0 || num_pad_chars < 0) { RETURN_ZVAL(*input, 1, 0); } diff --git a/ext/standard/tests/strings/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt index 6eaff1514b..886743a8b7 100644 Binary files a/ext/standard/tests/strings/str_pad.phpt and b/ext/standard/tests/strings/str_pad.phpt differ