ID: 13351
Updated by: rasmus
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Analyzed
Bug Type: Strings related
Operating System: Linux 2.2.19
PHP Version: 4.0.6
New Comment:
Hrm.. Unable to reproduce. And the code does pre-scan the line to see if it contains
a break char.
This code:
$str = "foo bar\n123456789 123456789 123456789 123456789 123456789 123456789
123456789 baz";
echo wordwrap($str,74);
Does exactly what I would expect. Please post an actual script snippet that isn't
doing what you think it should.
Previous Comments:
------------------------------------------------------------------------
[2001-09-17 15:47:42] [EMAIL PROTECTED]
When word-wrapping text, the wordwrap function fails to reset its character count when
encountering the break character in input text. As an example, when supplied with the
text
"foo bar\n<70 characters here> baz"
it will break before 'baz', instead of some time after 'baz' as it should (assuming
the standard 75 char line length and \n break char)
I've checked the source ( /ext/standard/string.c roughly around lines 395, 405, 442
and 456) and this is indeed the case. I can probably find time to write and send a
patch to the appropriate person if necessary, but this may be more hassle to integrate
than that person just doing the easy fix themselves :-)
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13351&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]