#47335 [Opn->Bgs]: get_called_class() sometimes returning incorrect value
ID: 47335
Updated by: felipe@php.net
Reported By: php at kennel17 dot co dot uk
-Status: Open
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Win32
PHP Version: 5.3.0beta1
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
Previous Comments:
------------------------------------------------------------------------
[2009-02-07 14:54:35] php at kennel17 dot co dot uk
Description:
------------
The new get_called_class() function returns the wrong class name when
called from within a static method, when that function is called from an
instantiated class method.
Reproduce code:
---------------
<?php
class MyClass {
function GetClassName() {
return get_called_class();
}
}
class OtherClass {
function Foo() {
return MyClass::GetClassName();
}
}
$c = new OtherClass;
print( MyClass::GetClassName() . "\n");
print( OtherClass::Foo() . "\n");
print( $c->Foo() . "\n");
?>
Expected result:
----------------
MyClass
MyClass
MyClass
Actual result:
--------------
MyClass
MyClass
OtherClass
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47335&edit=1
Thread (4 messages)