Nested functions and stackoverflow
| From: | Rasmus Resen Amossen | Date: | Thu, 14 Dec 2000 13:09:09 +0000 |
| Subject: | Nested functions and stackoverflow | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-30287@lists.php.net to get a copy of this message | ||
Look at the following situation:
In a php-function, say "func()", I "include()" a php-file, say
"hello1.php".
Inside "hello1.php" I initialize a variable, say "$var" and create a
link to another php-file, say "hello2.php".
In "hello2.php" I check for the existence of "$var" and calls the
function "func()" if it exists.
Here is the problem:
If the user follows the link to "hello2.php" the function func() has in
practice been called inside itself. Or does php clear the stack, when
the html-page as been generated?
If not, we got the following situation:
func() {
func() {
func() {
func() {
func() {
...
...
}
}
}
}
}
-And that MUST produce a stackoverflow some time.
Am I right?!
--
Rasmus Resen Amossen | stud.mat.dat at the University of Copenhagen
Jagtvej 120, 2. 239 | http://www.math.ku.dk/muh
2200 Kbh. N | http://w1.1444.telia.com/~u144400001