php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28139 Recursive function call?
Submitted: 2004-04-24 22:56 UTC Modified: 2004-04-24 23:31 UTC
From: a-dead-trousers at aon dot at Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: Irrelevant OS: winxp
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: a-dead-trousers at aon dot at
New email:
PHP Version: OS:

 

 [2004-04-24 22:56 UTC] a-dead-trousers at aon dot at
Description:
------------
I'm wondering about PHP not supporting recursive function calls. (I read bug report #2004 --> PHP does not support recursive function calls at all)


I don't know if this feature can be implemented easily (seems to go down to zend engine) but it would be fantastic if it could be implemented.

Reproduce code:
---------------
function countdown($var) {
  $var--;
  countdown($var);
  echo $var;
}

countdown(10);

//tested with PHP 4.3.2 (Zend Studio)
//and PHP 5.0.0 RC1 (Apache)
//on Win XP (Probably a win only problem)

Expected result:
----------------
9 8 7 6 5 4 3 2 1

Actual result:
--------------
Nothing!
PHP dose not crash!!!
The browser reports "Document contains no data"
Neither the log file of the webserver nor the php logfile reports anything.

If this feature can't be implemented it would be fantastic if PHP could show an errormessage or something similar e.g. logfileentry (even if it crashes would be better than doing nothing ;) )

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-24 22:58 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 [2004-04-24 23:20 UTC] a-dead-trousers at aon dot at
Shit...
Now i found out what i have done wrong...
Sorry, for having posted such an stupid bug.

----------
echo '1000 times sorry:'

function countdown($var) {
  $var--;
  if ($var > 0) countdown($var);
  echo ' sorry,';
}

countdown(1000);
----------
 [2004-04-24 23:31 UTC] derick@php.net
Yup, recursion works fine, infinite recursion doesnt.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 10:01:28 2024 UTC