php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8061 wordwrap
Submitted: 2000-11-30 18:20 UTC Modified: 2000-11-30 20:29 UTC
From: al dot wo at gmx dot de Assigned:
Status: Closed Package: Strings related
PHP Version: 4.0.3pl1 OS: Windows NT, Unix
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: al dot wo at gmx dot de
New email:
PHP Version: OS:

 

 [2000-11-30 18:20 UTC] al dot wo at gmx dot de
The function wordwrap seems to have a bug:

$tmp1="xxxxxxxx! dsfksdjfklsdjf sdflkjxxxx 1111";
$tmp2 = wordwrap($tmp1, 39);

this gives the *wrong* result - this string is 40 chars long!:
--- Cut ---
xxxxxxxx! dsfksdjfklsdjf sdflkjxxxx 1111
--- Cut ---

if you use
$tmp1="xxxxxxxx! dsfksdjfklsdjf sdflkjxxxx 1111x";
$tmp2 = wordwrap($tmp1, 39);

this gives the *correct* result:
--- Cut ---
xxxxxxxx! dsfksdjfklsdjf sdflkjxxxx
1111x
--- Cut ---

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-30 20:29 UTC] fmk@php.net
Counter used to find split position was compared with the string length. A string of length 40 will have positions 0-39.
The bug has been fixed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 06:01:32 2024 UTC