|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-09-17 15:47 UTC] jon at siliconcircus dot 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 :-) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 08:00:02 2025 UTC |
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.