PHP :: Bug #37846 :: wordwrap() wraps incorrectly
| Bug #37846 | wordwrap() wraps incorrectly | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2006-06-19 10:55 UTC | Modified: | 2006-07-28 12:24 UTC |
|
||||||||||
| From: | bugs dot php dot net at jonatan dot com | Assigned: | ||||||||||||
| Status: | Closed | Package: | Strings related | |||||||||||
| PHP Version: | 5.1.4 | OS: | Mac OS X 10.4.6 | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2006-06-19 10:55 UTC] bugs dot php dot net at jonatan dot com
Description:
------------
wordwrap() wraps incorrectly, wrapping too early in some
situations. As the example below shows, PHP wraps one of the
long lines ("Some text") at the maximum line length (9
characters in this case) and wraps the other one at a shorter
line length. Removing the first line from the test case
results in different but equally buggy wrapping.
I'm using Marc Liyanage's build of PHP, version 5.1.4 on an
Intel Mac.
Reproduce code:
---------------
<?php
$input =
'Some tex '.
'Some tex '.
'Some text '.
'Some tex '.
'Some text '.
'Some tex';
echo '<pre>'.wordwrap( $input, 9 )."</pre>\n";
?>
Expected result:
----------------
Some tex
Some tex
Some text
Some tex
Some text
Some tex
Actual result:
--------------
Some tex
Some tex
Some text
Some tex
Some
text
Some tex
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2006-06-19 13:09 UTC] pajoye@php.net
[2006-06-19 13:33 UTC] pajoye@php.net
[2006-06-19 15:14 UTC] bugs dot php dot net at jonatan dot com
[2006-06-19 15:57 UTC] tony2001@php.net
[2006-06-19 16:31 UTC] bugs dot php dot net at jonatan dot com
[2006-06-20 11:51 UTC] tony2001@php.net
$s = ' s '. ' t '; is equal to ' s t ' If you really want to get several text lines - you need to use "" and \n.[2006-06-20 13:17 UTC] bugs dot php dot net at jonatan dot com
[2006-06-20 13:40 UTC] bugs dot php dot net at jonatan dot com
[2006-06-20 13:57 UTC] bugs dot php dot net at jonatan dot com
[2006-06-20 14:00 UTC] tony2001@php.net
[2006-06-20 14:00 UTC] bjori@php.net
[2006-06-20 14:39 UTC] bugs dot php dot net at jonatan dot com
[2006-06-20 21:47 UTC] bugs dot php dot net at jonatan dot com
[2006-06-21 07:39 UTC] tony2001@php.net
[2006-06-21 08:15 UTC] bugs dot php dot net at jonatan dot com
[2006-06-21 08:25 UTC] tony2001@php.net
[2006-06-21 08:32 UTC] bugs dot php dot net at jonatan dot com
[2006-06-21 11:06 UTC] mgf@php.net
[2006-07-28 12:24 UTC] tony2001@php.net