#22960 [NEW]: Value of the constant __CLASS__

From: Date: Sun, 30 Mar 2003 11:54:27 +0000
Subject: #22960 [NEW]: Value of the constant __CLASS__
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-36701@lists.php.net to get a copy of this message
From: thixit at yahoo dot com Operating system: PHP version: 4.3.1 PHP Bug Type: Class/Object related Bug description: Value of the constant __CLASS__ Concerning the magical constant __CLASS__ <?php class foo { function a() { print __CLASS__ . "\n"; } } class bar extends foo { function b() { print __CLASS__ . "\n"; } } $foo = new foo; $bar = new bar; print '<pre>'; $foo->a(); // foo $bar->a(); // foo $bar->b(); // bar print '</pre>'; ?> I'm not sure about the definition of magical constant, but IMHO __CLASS__ should be changed to reflect the current class that it is in at that moment. This would be useful when use it in a static method where get_class() cannot be used. -- Edit bug report at http://bugs.php.net/?id=22960&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=22960&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=22960&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=22960&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=22960&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=22960&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=22960&r=support Expected behavior: http://bugs.php.net/fix.php?id=22960&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=22960&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=22960&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=22960&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22960&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=22960&r=dst IIS Stability: http://bugs.php.net/fix.php?id=22960&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=22960&r=gnused

« previous php.bugs (#36701) next »