From: toomuchphp-phpbugs at yahoo dot com Operating system: Any PHP version: 5.1.0RC1 PHP Bug Type: Feature/Change Request Bug description: More information about class methods
Description: ------------ Inside any class method, there are as many as 3 related class and it would be useful to have all of them as magic constants, and also in the debug_backtrace function. Currently only __CLASS__ is available (the name of the direct owner of the method). It would be good to know the name of the child class (if the method was called as part of a child class), and the name of the calling class if the method was called statically (the same as get_class($this) inside a static method). This information would be most useful in the debug_backtrace() array. debug_backtrace() was recently modified to report the direct owner class name rather than the inheriting class' name (see bug #30828) but it would really be more helpful in debugging to have all three possible class names available. Reproduce code: --------------- class A { function A() { echo 'direct owner: '.__CLASS__."\n"; echo 'called as part of: '.__INHERITED_BY__."\n"; echo 'called by instance of: '.__STATIC_CALLER__."\n"; } } class B extends A { } class C { function __construct() { B::A(); } } new C(); Expected result: ---------------- direct owner: A called as part of: B called by instance of: C -- Edit bug report at http://bugs.php.net/?id=34804&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34804&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34804&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34804&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34804&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34804&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34804&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34804&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34804&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34804&r=support Expected behavior: http://bugs.php.net/fix.php?id=34804&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34804&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34804&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34804&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34804&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34804&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34804&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34804&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34804&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34804&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34804&r=mysqlcfg