Date: 07/09/00
- Next message: Zeev Suraski: "Re: [PHP-DEV] Extensions calling C++"
- Previous message: Zeev Suraski: "Re: [PHP-DEV] Extensions calling C++"
- In reply to: Manuel Lemos: "Re: [PHP-DEV] *crash* on try to find out how many nestinglevelsare allowed"
- Next in thread: Manuel Lemos: "Re: [PHP-DEV] *crash* on try to find out how manynestinglevelsare allowed"
- Reply: Manuel Lemos: "Re: [PHP-DEV] *crash* on try to find out how manynestinglevelsare allowed"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
The problem is that this arbitrary limit is meaningless; Calling a certain
PHP function may exhaust your stack, whereas calling another one even a
thousand times recursively may not exhaust it. It depends on the function.
Zeev
At 22:41 09/07/2000, Manuel Lemos wrote:
>Hello Andi,
>
>On 09-Jul-00 12:48:32, you wrote:
>
> >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
> >will not only slow down PHP but it will also pose the question of where the
> >limit is. Not all systems have the same stack size or each up the stack at
> >the same rate.
> >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?
>
>I'm afraid you are missing the point. Nobody writes useful scripts that go
>on infinite recursion on purpose. So, if scripts go on infinite recursion
>that was a programmer's mistake.
>
>The problem with PHP is that it crashes without giving any clue to the
>programmer that it crashed because a script went infinite recursion.
>
>Although the crash was caused by a programmer's mistake, PHP could help by
>having some control on to how deep functions can call themselves directly
>or indirectly.
>
>I don't think the checks should be made against the current process CPU
>stack pointer address but rather have a configuration option that tells how
>many nested calls a function is allowed to make to itself directly on
>indirectly. When the number of calls is exceeded the script simply exits
>with a runtime error saying something like "the limit of recursive calls to
>function xyz() was exceeded".
>
>As for the overhead of this it could be eliminated by having some option to
>tell whether to make or not recursion checks. If recursion checks are off,
>I believe that the overhead is just of checking that variable in all
>functions which I think it is neglectable.
>
>The point of all this for you is that you avoid bogus PHP crash bug reports
>that are due to infinite recursion.
>
>
>Regards,
>Manuel Lemos
>
>Web Programming Components using PHP Classes.
>Look at: email protected>?subject=Re:%20[PHP-DEV]%20*crash*%20on%20try%20to%20%20find%20out%20how%20many%20nestinglevelsare%20%20allowed&replyto=4.3.2.7.2.20000709235800.0353c5a8 <email protected>">mlemos <email protected>">http://phpclasses.UpperDesign.com/?user=mlemos <email protected>
>--
>E-mail: mlemos <email protected>
>URL: http://www.mlemos.e-na.net/
>PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
>--
>
>
>--
>PHP Development Mailing List <http://www.php.net/>
>To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
>For additional commands, e-mail: php-dev-help <email protected>
>To contact the list administrators, e-mail: php-list-admin <email protected>
-- Zeev Suraski <zeev <email protected>> http://www.zend.com/-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Zeev Suraski: "Re: [PHP-DEV] Extensions calling C++"
- Previous message: Zeev Suraski: "Re: [PHP-DEV] Extensions calling C++"
- In reply to: Manuel Lemos: "Re: [PHP-DEV] *crash* on try to find out how many nestinglevelsare allowed"
- Next in thread: Manuel Lemos: "Re: [PHP-DEV] *crash* on try to find out how manynestinglevelsare allowed"
- Reply: Manuel Lemos: "Re: [PHP-DEV] *crash* on try to find out how manynestinglevelsare allowed"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

