From d24465ba8ab6f62ad310c7f85910c7912d1c48d8 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Thu, 13 May 2004 17:44:23 +0000 Subject: [PATCH] Fixed bug #28386 (wordwrap() wraps lines 1 character too soon). --- ext/standard/string.c | 2 +- ext/standard/tests/strings/bug28386.phpt | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 ext/standard/tests/strings/bug28386.phpt 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 -- 2.50.1