php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13351 wordwrap ignores split character when counting input characters
Submitted: 2001-09-17 15:47 UTC Modified: 2001-10-08 10:43 UTC
From: jon at siliconcircus dot com Assigned:
Status: Closed Package: Strings related
PHP Version: 4.0.6 OS: Linux 2.2.19
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jon at siliconcircus dot com
New email:
PHP Version: OS:

 

 [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 :-)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-09-17 16:18 UTC] 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 16:27 UTC] sniper@php.net
status -> feedback

(analyzed should be used when bug can be reproduced..)

 [2001-10-08 10:43 UTC] sander@php.net
No feedback. Closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 12:01:30 2024 UTC