ID:               42591
 Comment by:       crrodriguez at suse dot de
 Reported By:      kraghuba at in dot ibm dot com
 Status:           Open
 Bug Type:         Strings related
 Operating System: linux, windows
 PHP Version:      5CVS-2007-09-07 (snap)
 New Comment:

In case this is considered a bug ( IMHO it should emit such warning)

fix:

http://www.kissofjudas.net/patches/wordwrap.patch


Previous Comments:
------------------------------------------------------------------------

[2007-09-07 16:30:30] kraghuba at in dot ibm dot com

Description:
------------
wordwrap() doesn't generate warning message when width argument is
given  as a negative or zero value. 

this is applicable to php5 and php6.

Reproduce code:
---------------
<?php
 $text = "The quick brown fox jumped over the lazy dog.";

 var_dump( wordwrap($text, 0, "<br/>\n") );
 var_dump( wordwrap($text, -1 , "<br />\n") );

 var_dump( wordwrap($text, 0) );
 var_dump( wordwrap($text, -1) );
?>

Expected result:
----------------
warning messages should be generated

Actual result:
--------------
string(85) "The<br/>
quick<br/>
brown<br/>
fox<br/>
jumped<br/>
over<br/>
the<br/>
lazy<br/>
dog."
string(93) "The<br />
quick<br />
brown<br />
fox<br />
jumped<br />
over<br />
the<br />
lazy<br />
dog."
string(45) "The
quick
brown
fox
jumped
over
the
lazy
dog."
string(45) "The
quick
brown
fox
jumped
over
the
lazy
dog."


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42591&edit=1

Reply via email to