#34421 [Opn->Bgs]: get_class and debug_backtrace report wrong class for inherited static methods

From: Date: Thu, 08 Sep 2005 10:46:37 +0000
Subject: #34421 [Opn->Bgs]: 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-84720@lists.php.net to get a copy of this message
 ID:               34421
 Updated by:       johannes@php.net
 Reported By:      wkonkel at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: redhat
 PHP Version:      5.0.5
 New Comment:

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. 


Previous Comments:
------------------------------------------------------------------------

[2005-09-08 09:36:40] wkonkel at gmail dot com

fixed typo in summary

------------------------------------------------------------------------

[2005-09-08 09:34:30] wkonkel at gmail dot com

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 this bug report at http://bugs.php.net/?id=34421&edit=1


Thread (16 messages)

« previous php.bugs (#84720) next »