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
 [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-2019 The PHP Group
All rights reserved.
Last updated: Mon Sep 23 11:01:27 2019 UTC