Re: *crash* on try to find out how many nesting levelsare allowed
| From: | Dominic J. Eidson | Date: | Sun, 09 Jul 2000 16:10:48 +0000 |
| Subject: | Re: *crash* on try to find out how many nesting levelsare allowed | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-23929@lists.php.net to get a copy of this message | ||
On Sun, 9 Jul 2000, Andi Gutmans wrote:
> >Stanislav Malyshev wrote:
> > >
> > > w>> I wanted to find out how many nesting levels are allowed, but after
> > > w>> class "a" gets instanciated from inside of "b", PHP
> > > w>> crashes, that
> > should
> > > w>> not be.
> > >
> > > And what did you expect? You tried to crash it, you succeeded. Infinite
> > > recursion leads to crash. Try it in C, you get the same.
I believe his point was that it crashed after _3_ levels of recursion, and
not _infinite recursion_ ... Then again, his code might not limit the
number of recursions the way he expects it to (i.e. a bug in his PHP
script.)
> Your attitude is also incorrect. It can only be fixed, as far as I know, by
> adding code which will limited the amount of recursive function calls. This
I seem to remember that there at some point _was_ a limit to the number of
recursions you could have in PHP - IIRC, several people in #PHP complained
because their scripts exceeded the (at the time) limit of 500 (?)
frames on the "stack"... (500 levels of recursion)
> In my opinion, we are better off leaving it the way it is for now although
> for multi-threaded servers we might want to enable the *slow* approach.
> Anyway, maybe the best is not to write infinite recursion?
The best is always to not write infinite recursion - but wouldn't it be
beneficial for PHP to somehow protect against infinite recursion... Set an
arbitrary limit to the number of recursions - possibly a configure option
in php.ini...
--
Dominic J. Eidson
"Baruk Khazad! Khazad ai-menu!" - Gimli
-------------------------------------------------------------------------------
http://www.the-infinite.org/ http://www.the-infinite.org/~dominic/