ID: 49979 Updated by: johan...@php.net Reported By: insideone at rambler dot ru -Status: Open +Status: Bogus Bug Type: Feature/Change Request Operating System: Windows XP PHP Version: 5.2.11 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php These constants ave a specific compile-time meaning. what you are looking for is a way to make your functions not-deterministic what we certainly don't want to support. If youreally want to do suchbad stuff: All information needed should be availablevia debug_backtrace() Previous Comments: ------------------------------------------------------------------------ [2009-10-23 23:06:47] insideone at rambler dot ru Description: ------------ I wrote CMS and have faced problem. The system is grounded on modular connection of classes. It is possible with __ autoload () - many thanks! But it would be healthy not to refresh value Magic constants inside __ autoload (). Namely __ FUNCTION __ and __ METHOD __. They lose meaning inside __ autoload () though could benefit. Advantage example I result in code. Reproduce code: --------------- // file: "index.php" // Example of desirable call function __autoload($Class){ require('engine/' . __CLASS__ . '/' . $Class . '.php'); } $Data = new _Data; $Data->RuleAdd("_NOT_NULL"); // file: "engine/_Data.php" class _Data{ $Rules; public function RuleAdd($RULE_NAME){ // add new callback function from class $RULE_NAME (directory "engine/_Data/_$RULE_NAME.php") $Rules[$RULE_NAME] = call_user_func(Array($RULE_NAME, 'main')); }} // file: "engine/_Data/_NOT_NULL.php" class _NOT_NULL{ public function main(&$DATA){ return ($DATA)?:true:false; }} Expected result: ---------------- In the given example at inquiry of an unknown class $RULE_NAME ("$this-> Rules [$RULE_NAME] = call_user_func (Array ($RULE_NAME, RULE_CALLBACK));") it is necessary to load automatically it from a folder "engine / _ Data / _ NON_NULL.php" under the class name and demanded $RULE_NAME, but function __ autoload () it does not allow. Complicating __ autoload () but this distortion is probably finite. Magic constants are illogically refreshed in __ autoload () because they are necessary when do not know where the code is now fulfilled. And when you write Magic constants in function __ autoload () you already known that they are equal. Therefore they there are useless. Actual result: -------------- __autoload($Class) load this file: "engine//NOT_NULL.php" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49979&edit=1