#7440 [Opn->Csd]: Print function calling stack
| From: | derick@php.net | Date: | Sun, 01 Jun 2003 21:44:36 +0000 |
| Subject: | #7440 [Opn->Csd]: Print function calling stack | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-40846@lists.php.net to get a copy of this message | ||
ID: 7440
Updated by: derick@php.net
Reported By: feng at i-bizz dot net
-Status: Open
+Status: Closed
Bug Type: Feature/Change Request
Operating System: anyone
PHP Version: 4.0.3pl1
New Comment:
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at
http://www.php.net/downloads.php
PHP 4.3 and higher have debug_backtrace() (and print_debug_backtrace())
for this.
Previous Comments:
------------------------------------------------------------------------
[2002-01-28 20:24:17] yohgaki@php.net
Use APD for now. (It's not standard extension though...)
http://apd.communityconnect.com/
------------------------------------------------------------------------
[2000-10-24 16:53:06] feng at i-bizz dot net
When we have functions who calls another function, it is very easy to
lost the track of who is calling who and who generated the bug that
created an error.
Lets visually see the problem (I'm using Perl-like debug notation)
..
main.php3:5: ListBooks();
some where in main.php3 we called the ListBooks function, which is
an abstraction layer for the code that will query the database.
_sp.inc.php3:56: ExecSQL("select from BOOKS");
Somewhere (deep) inside the ListBooks() function, we have a call to
ExecSQL(), which will query the database, and have error handling
routines. Here we have a type which will trigger an error (it is
missing "*" inside the string)
_commom.inc.php3:30: $q = mysql_query($query);
_commom.inc.php3:31: if (!$q$) {
_commom.inc.php3:32: echo "we have an error here!";
_commom.inc.php3:33: return mysql_error();
_commom.inc.php3:33: }
What happens here? The error will be generated at the line 30 in the
file _commom.inc.php3 but it wasn't generated there! It was generated
somewhere in the upper layers, in some of the callers.
Now, wouldn't be cool if we could print the function call stack?
This way we could track up, knowing where the error could be hidden! We
have a good example from the Perl debugging facilities.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=7440&edit=1