From: Derick Rethans Date: Thu, 18 Jan 2001 21:46:24 +0000 (+0000) Subject: - Fix for bug #8367 (wordwrap not cutting correctly) X-Git-Tag: php-4.0.5RC1~527 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9a3cb4559f54f11b5806eb029790b111625de986;p=php - Fix for bug #8367 (wordwrap not cutting correctly) --- 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;