|  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.
Bug Type:
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
--- Cut ---


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-30 20:29 UTC]
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: Thu Jul 18 14:01:29 2024 UTC