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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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 19 14:01:30 2024 UTC