Bug #11009 Updated: Recursive call causes crash

From: Date: Mon, 21 May 2001 22:14:58 +0000
Subject: Bug #11009 Updated: Recursive call causes crash
Groups: php.dev 
Request: Send a blank email to php-dev+get-56144@lists.php.net to get a copy of this message
ID: 11009 User Update by: millz@incogen.com Status: Closed Bug Type: Reproducible crash Operating system: RedHat 6.2 PHP Version: 4.0.5 Description: Recursive call causes crash Yeah, but the issue is not that I picked a "bad" way of doing this task, but whether or not a recursive call should be able to go this "deep" in PHP....i guess not. Thanks for the help though, Jas Previous Comments: --------------------------------------------------------------------------- [2001-05-22 00:06:08] brianlmoon@php.net I personally used sprintf for this job before str_repeat came along. However, it is a useless argument now. --------------------------------------------------------------------------- [2001-05-21 22:58:04] millz@incogen.com yeah, but a while($length--) was super slow (10-20 times slower)...actually timed-out on the simplest runs. maybe a for() is faster?! --------------------------------------------------------------------------- [2001-05-21 22:53:16] brianlmoon@php.net This is more of a programing error. This is a poor way to use recursive calls. A loop is the correct way to handle this. --------------------------------------------------------------------------- [2001-05-21 22:06:27] millz@incogen.com I created a function called pad which performs exactly what str_repeat does (didn't realize str_repeat was there originally). function pad($length,$padVar="-"){ if($length<=0){return;} else{return pad($length-1,$padVar).$padVar;} } When passing a length > about 5000 the page will not load and I quickly get this error in the php.error log: [notice] child pid 15040 exit signal Segmentation fault (11) I assume it is b/c the function stack is just not up to the task, but I thought I would let you know anyway. Of course I am using str_repeat now.... Thanks! Jason --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=11009

« previous php.dev (#56144) next »