Edit report at http://bugs.php.net/bug.php?id=14393&edit=1
ID: 14393 Updated by: [email protected] Reported by: foobardotcom at poczta dot onet dot pl Summary: Function calling filename built-in access -Status: Open +Status: Bogus Type: Feature/Change Request -Package: Feature/Change Request +Package: Scripting Engine problem Operating System: all PHP Version: 4.1.0 Block user comment: N Private report: N New Comment: Incomprehensible request. Previous Comments: ------------------------------------------------------------------------ [2002-03-08 11:11:28] webmail at webcodefocus dot com I would find something like this very useful: file: ErrorList.php ------------------- // ErrorList is an object // Add is a method of ErrorList function Add($message, $internal_message="") { if (MASTER_DEBUG) { $function = func_get_caller(); $tmp = "[$internal_message - $function]"; } $this-Properties[] = "$message $tmp"; } file: page.php -------------- $ErrorList = new ErrorList; ... function doSomething($value) { if (is_null($value)) { $ErrorList->Add("value must be defined", __FILE__); return(false); } } .. $ErrorList->ShowErrors(); // the above would print: // "value must be defined [page.php - doSomething()]" ------------------------------------------------------------------------ [2001-12-09 10:35:33] foobardotcom at poczta dot onet dot pl Create function, that will not constraint specifying __FILE__ who is calling it. function vote($num) { global $votes; $vot...@func_get_caller()] += $num; } // 1.php: vote(5); // 2.php: vote(3); // all.php: include("1.php"); include("2.php"); print_r($votes); // should show array: array([1.php] => 5, [2.php] => 3) // but without this function will show: array([0] => 8) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=14393&edit=1
