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

Pull Requests

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: Tue Oct 15 06:01:26 2024 UTC