ID: 31716
Updated by: [EMAIL PROTECTED]
Reported By: wildmaple at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: linux
PHP Version: 5.0.3
New Comment:
See #31686, describing the very same problem.
Previous Comments:
------------------------------------------------------------------------
[2005-01-27 08:27:01] wildmaple at yahoo dot com
And I can't get the inherited class name by self, self always point to
parent class too.
------------------------------------------------------------------------
[2005-01-27 08:12:28] wildmaple at yahoo dot com
Description:
------------
get_class() invoked with no argument, always return the original
classname, in which it is first referenced.
Reproduce code:
---------------
#!/bin/php
<?php
class parentCls{
static function initPStatic(){
echo("parentCls::initPStatic said
get_class()=='".get_class()."'\n");
echo("\n");
}
function initP(){
echo("parentCls::initP said
get_class()=='".get_class()."'\n");
echo("\n");
}
}
class childCls extends parentCls{
}
childCls::initPStatic();
$c=new childCls();
$c->initP();
?>
Expected result:
----------------
parentCls::initPStatic said get_class()=='childCls'
parentCls::initP said get_class()=='childCls'
Actual result:
--------------
parentCls::initPStatic said get_class()=='parentCls'
parentCls::initP said get_class()=='parentCls'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31716&edit=1