From: Ilia Alshanetsky Date: Mon, 31 Aug 2009 12:28:46 +0000 (+0000) Subject: Fixed bug #49361 (wordwrap() wraps incorrectly on end of line boundaries). X-Git-Tag: php-5.2.11RC2~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ec9c7a45996cb7847c2f5f6d72ee1d8c2ad1d0b7;p=php Fixed bug #49361 (wordwrap() wraps incorrectly on end of line boundaries). --- diff --git a/NEWS b/NEWS index 217285beb5..f79275d629 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ PHP NEWS - Fixed leak on error in popen/exec (and related functions on Windows. (Pierre) +- Fixed bug #49361 (wordwrap() wraps incorrectly on end of line boundaries). + (Ilia, code-it at mail dot ru) - Fixed bug #49289 (bcmath module doesn't compile with phpize configure). (Jani) - Fixed bug #49286 (php://input (php_stream_input_read) is broken). (Jani) diff --git a/ext/standard/string.c b/ext/standard/string.c index 5d32958088..87c6d94216 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -836,7 +836,7 @@ PHP_FUNCTION(wordwrap) laststart = lastspace = 0; for (current = 0; current < textlen; current++) { if (text[current] == breakchar[0]) { - laststart = lastspace = current; + laststart = lastspace = current + 1; } else if (text[current] == ' ') { if (current - laststart >= linelength) { newtext[current] = breakchar[0];