Fixed bug #49361 (wordwrap() wraps incorrectly on end of line boundaries).

This commit is contained in:
Ilia Alshanetsky 2009-08-31 12:28:46 +00:00
parent c3615ef874
commit 820d7d28b7

View File

@ -1034,7 +1034,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];