From: Ilia Alshanetsky Date: Thu, 13 May 2004 17:44:23 +0000 (+0000) Subject: Fixed bug #28386 (wordwrap() wraps lines 1 character too soon). X-Git-Tag: RELEASE_0_1~206 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d24465ba8ab6f62ad310c7f85910c7912d1c48d8;p=php Fixed bug #28386 (wordwrap() wraps lines 1 character too soon). --- diff --git a/ext/standard/string.c b/ext/standard/string.c index 9bac292371..b328dcf786 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -661,7 +661,7 @@ PHP_FUNCTION(wordwrap) } else if (text[current] == ' ') { if (current - laststart >= linelength) { newtext[current] = breakchar[0]; - laststart = current; + laststart = current + 1; } lastspace = current; } else if (current - laststart >= linelength && laststart != lastspace) { diff --git a/ext/standard/tests/strings/bug28386.phpt b/ext/standard/tests/strings/bug28386.phpt new file mode 100644 index 0000000000..9c7c158bc9 --- /dev/null +++ b/ext/standard/tests/strings/bug28386.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #28386 (wordwrap() wraps text 1 character too soon) +--FILE-- + +--EXPECT-- +Some text +Some text +Some text +Some text