Bug #13351 Updated: wordwrap ignores split character when counting input characters
| From: | sniper@php.net | Date: | Mon, 17 Sep 2001 20:27:19 +0000 |
| Subject: | Bug #13351 Updated: wordwrap ignores split character when counting input characters | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-66138@lists.php.net to get a copy of this message | ||
ID: 13351
Updated by: sniper
Reported By: jon@siliconcircus.com
Old Status: Analyzed
Status: Feedback
Bug Type: Strings related
Operating System: Linux 2.2.19
PHP Version: 4.0.6
New Comment:
status -> feedback
(analyzed should be used when bug can be reproduced..)
Previous Comments:
------------------------------------------------------------------------
[2001-09-17 16:18:48] rasmus@php.net
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.
------------------------------------------------------------------------
[2001-09-17 15:47:42] jon@siliconcircus.com
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