#34421 [NEW]: get_class and debug_backtrace report wrong class forinherited static methods
From: wkonkel at gmail dot com
Operating system: redhat
PHP version: 5.0.5
PHP Bug Type: Class/Object related
Bug description: get_class and debug_backtrace report wrong class forinherited static methods
Description:
------------
When a static function is called in the scope of an extended class, the
static function still thinks it's being called in the scope of the base
class.
I found a similar bug at http://bugs.php.net/bug.php?id=30828 which was
fixed in 5.0.5, but the problem still remains.
Reproduce code:
---------------
<?
class baseClass {
static function do_get_class() {
return get_class();
}
static function do_backtrace() {
$backtrace = debug_backtrace();
return $backtrace[0]['class'];
}
}
class extendedBaseClass extends baseClass {
}
echo extendedBaseClass::do_get_class() . "<br>";
echo extendedBaseClass::do_backtrace() . "<br>";
?>
Expected result:
----------------
extendedBaseClass
extendedBaseClass
Actual result:
--------------
baseClass
baseClass
--
Edit bug report at http://bugs.php.net/?id=34421&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34421&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34421&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34421&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34421&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34421&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34421&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34421&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34421&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34421&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34421&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=34421&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=34421&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34421&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34421&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34421&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34421&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34421&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34421&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34421&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34421&r=mysqlcfg
Thread (16 messages)
- wkonkel at gmail dot com
- wkonkel at gmail dot com#34421 [Opn]: get_class and debug_backtrace report wrong class for inherited static methods
- johannes@php.net#34421 [Opn->Bgs]: get_class and debug_backtrace report wrong class for inherited static methods
- wkonkel at gmail dot com#34421 [Bgs->Opn]: get_class and debug_backtrace report wrong class for inherited static methods
- civilization_2 at hotmail dot com#34421 [Com]: get_class and debug_backtrace report wrong class for inherited static methods
- goat at daholygoat dot com#34421 [Com]: get_class and debug_backtrace report wrong class for inherited static methods
- civilization_2 at hotmail dot com#34421 [Com]: get_class and debug_backtrace report wrong class for inherited static methods
- johannes@php.net#34421 [Opn->Bgs]: get_class and debug_backtrace report wrong class for inherited static methods
- wkonkel at gmail dot com#34421 [Bgs->Opn]: get_class and debug_backtrace report wrong class for inherited static methods
- civilization_2 at hotmail dot com#34421 [Com]: get_class and debug_backtrace report wrong class for inherited static methods
- tony2001@php.net#34421 [Opn]: get_class and debug_backtrace report wrong class for inherited static methods
- civilization_2 at hotmail dot com#34421 [Com]: get_class and debug_backtrace report wrong class for inherited static methods
- thomas at gielfeldt dot dk#34421 [Com]: get_class and debug_backtrace report wrong class for inherited static methods
- thomas at gielfeldt dot dk#34421 [Com]: get_class and debug_backtrace report wrong class for inherited static methods
- thomas at gielfeldt dot dk#34421 [Com]: get_class and debug_backtrace report wrong class for inherited static methods
- nikic@php.netReq #34421 [Opn->Csd]: get_class and debug_backtrace report wrong class for inherited static methods