From:             bugs dot php dot net at jonatan dot com
Operating system: Mac OS X 10.4.6
PHP version:      5.1.4
PHP Bug Type:     Strings related
Bug description:  wordwrap() wraps incorrectly

Description:
------------
wordwrap() wraps incorrectly, wrapping too early in some 
situations. As the example below shows, PHP wraps one of the 
long lines ("Some text") at the maximum line length (9 
characters in this case) and wraps the other one at a shorter 
line length. Removing the first line from the test case 
results in different but equally buggy wrapping.

I'm using Marc Liyanage's build of PHP, version 5.1.4 on an 
Intel Mac.

Reproduce code:
---------------
<?php
$input =
    'Some tex '.
    'Some tex '.
    'Some text '.
    'Some tex '.
    'Some text '.
    'Some tex';
echo '<pre>'.wordwrap( $input, 9 )."</pre>\n";
?>

Expected result:
----------------
Some tex
Some tex
Some text
Some tex
Some text
Some tex


Actual result:
--------------
Some tex
Some tex
Some text
Some tex
Some
text
Some tex


-- 
Edit bug report at http://bugs.php.net/?id=37846&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37846&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=37846&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37846&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37846&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37846&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37846&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37846&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37846&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37846&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37846&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37846&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37846&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37846&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37846&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37846&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37846&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37846&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37846&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37846&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37846&r=mysqlcfg

Reply via email to