#31716 [Opn]: get_class() with no argument, always return the original classname
| From: | wildmaple at yahoo dot com | Date: | Thu, 27 Jan 2005 07:27:02 +0000 |
| Subject: | #31716 [Opn]: get_class() with no argument, always return the original classname | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-72917@lists.php.net to get a copy of this message | ||
ID: 31716
User updated by: wildmaple at yahoo dot com
Reported By: wildmaple at yahoo dot com
Status: Open
Bug Type: Class/Object related
Operating System: linux
PHP Version: 5.0.3
New Comment:
And I can't get the inherited class name by self, self always point to
parent class too.
Previous Comments:
------------------------------------------------------------------------
[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