#34421 [Com]: get_class and debug_backtrace report wrong class for inherited static methods

From: Date: Thu, 08 Sep 2005 20:59:44 +0000
Subject: #34421 [Com]: get_class and debug_backtrace report wrong class for inherited static methods
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-84760@lists.php.net to get a copy of this message
ID: 34421 Comment by: civilization_2 at hotmail dot com Reported By: wkonkel at gmail dot com Status: Open Bug Type: Feature/Change Request Operating System: redhat PHP Version: 5.0.5 New Comment: While we're at it, perhaps it would be nice to have a magic-variable for this? Previous Comments: ------------------------------------------------------------------------ [2005-09-08 16:56:56] goat at daholygoat dot com I also have to agree with wkonkel about this being a bug. I can't think of any reason why you shouldn't be able to do class introspection from a static method in the inherited class. It's very useful for building object factories, for example (a really major OO area). ------------------------------------------------------------------------ [2005-09-08 16:21:21] civilization_2 at hotmail dot com I have to agree with wkonkel. The example shown above works as expected in php4, so if this is by design then php5 is lacking a vital feature that php4 has, namely the ability to get the name of the extended class in a static function call to which resides in the base class. ------------------------------------------------------------------------ [2005-09-08 16:06:19] wkonkel at gmail dot com Although this is how it currently does work, this is not logical. If I specify that the scope to be "extendedBaseClass", then why is the scope "baseClass"? If this was not a static method, calling get_class() would return "extendedBaseClass" because the object simply isn't a "baseClass", it's an "extendedBaseClass". Static methods are no different. ------------------------------------------------------------------------ [2005-09-08 12:46:35] johannes@php.net 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 The static method is part of the base class, not of the extended. ------------------------------------------------------------------------ [2005-09-08 09:36:40] wkonkel at gmail dot com fixed typo in summary ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/34421 -- Edit this bug report at http://bugs.php.net/?id=34421&edit=1

« previous php.bugs (#84760) next »