summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2001-01-18 21:46:24 +0000
committerDerick Rethans <derick@php.net>2001-01-18 21:46:24 +0000
commit9a3cb4559f54f11b5806eb029790b111625de986 (patch)
tree546455380e327d76c66407e4452ab34795254293
parent405d11e604fe5bfc08d671db6be5f9b4cac80fb3 (diff)
downloadphp-git-9a3cb4559f54f11b5806eb029790b111625de986.tar.gz
- Fix for bug #8367 (wordwrap not cutting correctly)
-rw-r--r--ext/standard/string.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 15311417c5..c68f5d35d5 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -442,7 +442,7 @@ PHP_FUNCTION(wordwrap)
}
if (l == -1) {
/* couldn't break it backwards, try looking forwards */
- l = linelength;
+ l = linelength - 1;
while (l <= pgr) {
if (docut == 0)
{
@@ -456,13 +456,12 @@ PHP_FUNCTION(wordwrap)
if (docut == 1)
{
if (text[i+l] == ' ' || l > i-last) {
- strncat(newtext, text+last, i+l-last);
+ strncat(newtext, text+last, i+l-last+1);
strcat(newtext, breakchar);
- last = i + l;
+ last = i + l + 1;
break;
}
}
- l ++;
}
}
i += l+1;