#21515 [Opn->Csd]: Show the current functionname
| From: | derick@php.net | Date: | Wed, 08 Jan 2003 10:26:25 +0000 |
| Subject: | #21515 [Opn->Csd]: Show the current functionname | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-29432@lists.php.net to get a copy of this message | ||
ID: 21515
Updated by: derick@php.net
Reported By: gerwout@notenbomer.nl
-Status: Open
+Status: Closed
Bug Type: Feature/Change Request
Operating System: all
PHP Version: 4.3.0
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2003-01-08 04:20:36] gerwout@notenbomer.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;
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21515&edit=1