#36343 [Opn->Bgs]: Static var inheritence using Parent/child
| From: | tony2001@php.net | Date: | Thu, 09 Feb 2006 17:05:46 +0000 |
| Subject: | #36343 [Opn->Bgs]: Static var inheritence using Parent/child | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-93083@lists.php.net to get a copy of this message | ||
ID: 36343
Updated by: tony2001@php.net
Reported By: lordi at msdi dot ca
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Freebsd 6.0
PHP Version: 5.1.2
New Comment:
Yes, this is by design.
self:: is resolved during compile time.
Previous Comments:
------------------------------------------------------------------------
[2006-02-09 17:40:18] lordi at msdi dot ca
Description:
------------
I don't know if it is by design, but this is not what I would expect
logically...
Reproduce code:
---------------
<?php
class A {
static $var = 'foo';
static function getvar (){
return self::$var;
}
}
class B extends A{
static $var = 'bar';
}
echo A::getvar();
echo B::getvar();
?>
Expected result:
----------------
foobar
Actual result:
--------------
foofoo
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36343&edit=1