PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #12768 wordwrap crashes with 4 parameters and width=0
Submitted:15 Aug 2001 12:00pm UTC Modified: 4 Jan 2002 2:49pm UTC
From:marc dot pohl at wwf-gruppe dot de Assigned to:elixer
Status:Closed Category:Reproducible crash
Version:4.0.6 OS:Linux
View/Vote Developer Edit Submission

[15 Aug 2001 12:00pm UTC] marc dot pohl at wwf-gruppe dot de
hi,

i discovered a small bug in wordwrap. if you call this function with 4
parameters and a width of 0 your php-script will crash/timeout.

<pre>
<?php
 $string = "the quick brown fox ...";
 echo wordwrap($string, 0, "\n", 1),"\n";
?>
</pre>

here is an inconsistency with the 2-parameter version, which returns all
words separated by \n in this case

regards marc

[4 Jan 2002 2:49pm UTC] jimw@php.net
forcing a cut with a zero width doesn't make any sense. but segfault
fixed in cvs and this case now issues a warning. (but also found and
fixed a related crash if a multi-character break was used with a zero
width.)

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC