On Mon, 2007-01-08 at 23:59 +0100, Jochem Maas wrote: > Bill Moran wrote: > > With reference to: > > http://bugs.php.net/bug.php?id=40067 > > > > I'm confused as to why this was marked bogus, and the message that > > marked as such doesn't give much insight. > > > > It would seem to me that infinite recursion within PHP is a bug. > > Shouldn't the interpreter catch this sort of thing before it > > coredumps? Or is the design philosophy for PHP different than > > that? > > the way I understand it is that there is no decent way for the engine to > tell the difference between a piece of recursive code that will complete > and a piece of recursive code that will never complete ... so the only > sane solution is to leave it up to user land code to make sure the recursive > loop is not infinite. > > put another way if the engine catches/stops what it *thinks* is an infinite loop > then how would stopping the loop at an arbitrary location be any better > than dumping core? Ummm, on many systems you end up with a core dump with the following name: core.<pid>. Now multiply that by 1000 at 16 to 32 megs a piece. Not fun :) Anyways, the core dump happens because memory is exhausted and the engine is unable to allocate anymore. It should be possible for PHP to exit gracefully upon finding itself out of memory... Possibly it could allocate another 1k and write to the error logfile on which line it was running when it ran out of memory. Or better yet, maybe a debug_backtrace() output *drool*. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php