summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJani Taskinen <jani@php.net>2007-07-23 13:27:34 +0000
committerJani Taskinen <jani@php.net>2007-07-23 13:27:34 +0000
commit8eaa978e97443f2f6de037d5a2d78712ded8cb9e (patch)
tree5fc599dd5b5191873058f66d02e8ea3d4ec3fcc9
parent9b035b58f583b702879a5b53236527f70ba0ad36 (diff)
downloadphp-git-8eaa978e97443f2f6de037d5a2d78712ded8cb9e.tar.gz
- Fixed str_pad() when passed huge negative pad_length
-rw-r--r--ext/standard/string.c2
-rw-r--r--ext/standard/tests/strings/str_pad.phptbin15209 -> 17648 bytes
2 files changed, 1 insertions, 1 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 0abd0b4cc5..838d5b0ded 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -7309,7 +7309,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 (pad_length < 0 || num_pad_chars < 0) {
if (input_type == IS_UNICODE) {
RETURN_UNICODEL((UChar *)input, input_len, 1);
} else {
diff --git a/ext/standard/tests/strings/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt
index 8cca4dfc79..b13386d188 100644
--- a/ext/standard/tests/strings/str_pad.phpt
+++ b/ext/standard/tests/strings/str_pad.phpt
Binary files differ