php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #2004 recursive call limitation
Submitted: 1999-08-09 10:52 UTC Modified: 2000-06-11 19:24 UTC
From: gregori at datanetms dot co dot uk Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0 Beta 1 OS: linux (Redhat 6)
Private report: No CVE-ID: None
 [1999-08-09 10:52 UTC] gregori at datanetms dot co dot uk
I dunno where to reply to that ... so I do it here :

> PHP 4.0 (Zend) uses the stack for intensive data, rather than using
> the heap.  That means that its tolerance recursive functions
> is significantly lower than that of other languages.

> It's relatively easy to tell Zend not to use the stack for this
> data, and use the heap instead - which would greatly increase the
> number of recursive functions possible - in the price of reduced
> speed.  If you're interested in such a setting, let me know, we
> may add a compile-time switch.


We definitly need a such flag.

Recursive functions are really usefull when you want to do some
mathematics or work with directory tree for instance.

By the way ... if there are a little stack ... I think we could have
problem with big script ... I could imagine a script who call a couple
of functions who have a lot of parameters !? It could be a problem !? No
!?


It's a bit scaring to have a such limitation !?


thank you if you could add that,

gregori

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-11 19:24 UTC] zeev at cvs dot php dot net
Two things:

(1) You can edit zend.h, look for the line:
#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32))

And change it to:
#if 0 && (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32))

This will significantly reduce the load on the stack.

(2) This has nothing to do with the amount of arguments you pass around PHP functions;  These arguments don't use the process stack, but a high-level stack that's implemented on top of the process heap.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Jun 10 05:00:01 2026 UTC