From: phpbugs at replies dot cyways dot com
Operating system: Linux (CentOS 4.3)
PHP version: 5.1.5
PHP Bug Type: Feature/Change Request
Bug description: Cannot reference name of file calling function
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 bug report at http://bugs.php.net/?id=38549&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38549&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38549&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38549&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38549&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38549&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38549&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38549&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38549&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38549&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38549&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38549&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38549&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38549&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38549&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38549&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38549&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38549&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38549&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38549&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38549&r=mysqlcfg