#35266 [Opn->WFx]: __CLASS__ is not always right

From: Date: Thu, 17 Nov 2005 16:55:57 +0000
Subject: #35266 [Opn->WFx]: __CLASS__ is not always right
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-88424@lists.php.net to get a copy of this message
ID: 35266 Updated by: tony2001@php.net Reported By: markus at cultcom dot de -Status: Open +Status: Wont fix Bug Type: Feature/Change Request Operating System: Linux (Fedora Core 4) PHP Version: 5.0.5 New Comment: __CLASS__ is replaced with it's value during compile time. Also, I would consider it's right, because this method actually belong to the parent class, not to the derived one. Previous Comments: ------------------------------------------------------------------------ [2005-11-17 17:52:51] markus at cultcom dot de Description: ------------ __CLASS__ does not contain the correct class name in a generic class if method is called from a derived class. Reproduce code: --------------- <?php class Generic { public static function i_am() { print __CLASS__ . "\n"; } } class Derived extends Generic { } Generic::i_am(); // correct, print "Generic" Derived::i_am(); // wrong, should print "Derived" ?> Expected result: ---------------- If I call a method which was implemented in a parent class I need in any way access to the name of the class which actually was asked to execute the method... Actual result: -------------- Always the name of the class that actualy implements the method. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35266&edit=1

« previous php.bugs (#88424) next »