ID: 38549
Comment by: dtyschenko at soft-ukraine dot com
Reported By: phpbugs at replies dot cyways dot com
Status: Open
Bug Type: Feature/Change Request
Operating System: Linux (CentOS 4.3)
PHP Version: 5.1.5
New Comment:
You can use Exceptions call stack
Previous Comments:
------------------------------------------------------------------------
[2006-08-22 19:32:07] phpbugs at replies dot cyways dot com
Description:
------------
It appears to be impossible to determine the name of a file that calls
a function stored in another file, e.g., a class library included at
startup. The __FILE__ variable returns the name of the script which
contains the function called (the class library in this example), but
there doesn't seem to be any comparable variable that returns the name
of the file where the function is invoked.
In my particular case, I have a simple library function
debug('debugtext',trigger_level) which compares trigger_level to a
global value and prints 'debugtext' as appropriate. I'd like to be
able to print out the name of the file that called this function as
well so I can trace errors more efficiently. As it stands now, I don't
see any way to do this other than some kludge that uses
get_included_files().
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38549&edit=1