ID: 20049 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Closed Bug Type: Feature/Change Request Operating System: FreeBSD 4.7 PHP Version: 4.2.3 New Comment:
You can do this with the debug_backtrace() function in PHP 4.3.0 or higher. This is not exactly the same, but for now the only way to do this (technically). The __*__ constants are replaced during compile time and as it is (almost) impossible to get this date from the parent file. You can also have a look at xdebug (Xdebug.derickrethans.nl) which has functions for this. Derick Previous Comments: ------------------------------------------------------------------------ [2002-10-23 14:57:34] [EMAIL PROTECTED] I'm writing a script which calls a function which handles errors. The function lies in a different file (it was included) than where the function was called. index.php --> calls function in wine.inc --> calls function in db.inc --> calls error handling function in wine.inc --> prints error nicely and exits at index.php __PARENTFILE__ would be "" and __PARENTLINE__ would be "". At wine.inc __PARENTFILE__ would be "/path/to/index.php" and __PARENTLINE__ would be the line number where we left index.php (called the function in wine.inc). At db.inc __PARENTFILE__ would be "/path/to/wine.inc" and __PARENTLINE__ would be the line number where we left wine.inc (where the function called was in db.inc). Make sense? I couldn't find ANYTHING in documentation that allowed such a view into the system. A $_EXECUTION like global would be nice too, showing at the point called which files were open (either through includes or requires or FOPENs) and the line numbers they were at at the time of calling. Or maybe this would be more proper as a function returning an array of information? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20049&edit=1