From:             hallow at webmages dot com
Operating system: Linux
PHP version:      4.3.4
PHP Bug Type:     Feature/Change Request
Bug description:  Function Level Constands

Description:
------------
In building my own functions, in particular an include work-a-like that
does some pre and post processing, it would be very handy to have a
__CALLER__ constant that indicates the file the function was called from,
and and a __CLINE__ constant or something similar that indicates the line
number in the caller where the function was called from.



It appears that the only way to accomplish this within PHP by having the
function take __FILE__ and __LINE__ as parameters, which for an
potentially oft used function makes for a lot of extra typing.





Reproduce code:
---------------
function my_include(file,caller,line) {

   echo "Called from: ",$caller,", line number: ", $line;

   include(file);

}



my_include(file,__FILE__,__LINE__);  



could be:



function my_include(file) {

   echo "Called from: ", __CALLER__ , " , line number: ", __CLINE__;

   include(file);

}



my_include(file);



Expected result:
----------------
Called from: SOMEFILE, line number: SOMEINT


-- 
Edit bug report at http://bugs.php.net/?id=27639&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27639&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27639&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27639&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27639&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27639&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27639&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27639&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27639&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27639&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27639&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27639&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27639&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27639&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27639&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27639&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27639&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27639&r=float

Reply via email to