php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #21515 debug_backtrace() needs documentation.
Submitted: 2003-01-08 04:20 UTC Modified: 2003-01-19 00:21 UTC
From: gerwout at notenbomer dot nl Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.0 OS: all
Private report: No CVE-ID: None
 [2003-01-08 04:20 UTC] gerwout at notenbomer dot nl
Is it possible to create a getCurrentFunctionName() function?

If an user defined error occured (for example: you are not getting a valid SQL-resultset with your query) in a function, it would be handy to show the functionname where the error is generated.

Possible example:


function getQueryResultSet() {
 // requested code
 $currentFunctionName = getCurrentFunctionName();
 $query="select * from table";
 $result = mysql_query($query) or die ("The error occured in ". $currentFunctionName);
 return $result;
}

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-08 04:26 UTC] derick@php.net
You can use debug_backtrace() for this (which is new in PHP 4.3.0). (Try var_dump(debug_backtrace()); to see what output it gives), marking this bug as a doc problem, as debug_backtrace() has not been documented yet.

Derick
 [2003-01-08 04:27 UTC] derick@php.net
hah, nu even de daad by het woord voegen :-)
 [2003-01-08 11:22 UTC] philip@php.net
You can use the __FUNCTION__ constant as of PHP 4.3.0  It's documented somewhere with the other magical sorta-constants __FILE__, __LINE__, and __CLASS__.  __CLASS__ also became available in PHP 4.3.0

I think there's a bug somewhere for documented these sorta-constants as the manual doesn't document them very well.
 [2003-01-18 03:04 UTC] philip@php.net
__FUNCTION__ is now documented as per bug #19196.  

Am changing the topic of this bug report to reflect everyones deep desire for debug_backtrace() to be documented.  

We all agreed that the section on "Error Handling and Logging Functions" is the best place for debug_backtrace.
 [2003-01-19 00:21 UTC] philip@php.net
This beast is now documented:
http://cvs.php.net/cvs.php/phpdoc/en/reference/errorfunc/functions/debug-backtrace.xml

Have a nice day :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Aug 14 11:01:29 2024 UTC