php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #7440 Print function calling stack
Submitted: 2000-10-24 16:53 UTC Modified: 2003-06-01 16:44 UTC
From: feng at i-bizz dot net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.3pl1 OS: anyone
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: feng at i-bizz dot net
New email:
PHP Version: OS:

 

 [2000-10-24 16:53 UTC] 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-28 20:24 UTC] yohgaki@php.net
Use APD for now. (It's not standard extension though...)
http://apd.communityconnect.com/
 [2003-06-01 16:44 UTC] derick@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Nov 25 19:01:32 2024 UTC