php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12768 wordwrap crashes with 4 parameters and width=0
Submitted: 2001-08-15 12:00 UTC Modified: 2002-01-04 14:49 UTC
From: marc dot pohl at wwf-gruppe dot de Assigned: elixer (profile)
Status: Closed Package: Reproducible crash
PHP Version: 4.0.6 OS: Linux
Private report: No CVE-ID: None
 [2001-08-15 12:00 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-04 14:49 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.)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 06:01:30 2024 UTC