ID: 29647
Updated by: [EMAIL PROTECTED]
Reported By: mrpyle at libero dot it
Status: Bogus
Bug Type: Class/Object related
-Operating System: ANY
+Operating System: *
-PHP Version: 5.0.0
+PHP Version: 5.*
New Comment:
It does.
abstract class ParentClass
{
static public function modifyStaticProp($propName, $propValue)
{
self::${$propName} = $propValue ;
}
}
There is only one class, the class itself, aka ParentClass.
Previous Comments:
------------------------------------------------------------------------
[2004-08-14 10:11:23] mrpyle at libero dot it
Could you explain yourself better please?
If this isn't a bug IMHO it is a wrong/not desiderable behaviour:
self:: should refer to the current class and parent:: to the parent
class, if not this means that you cannot apply inheritance to classes
containing static members
------------------------------------------------------------------------
[2004-08-13 19:26:23] [EMAIL PROTECTED]
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
self is bound at compile time.
------------------------------------------------------------------------
[2004-08-13 12:17:33] mrpyle at libero dot it
Description:
------------
self:: into child class seems to refer to parent class, is this a bug?
Reproduce code:
---------------
<?php
abstract class ParentClass
{
static public function modifyStaticProp($propName, $propValue)
{
self::${$propName} = $propValue ;
}
}
class ChildClass extends ParentClass
{
static public $a ;
static public $b ;
}
ChildClass::modifyStaticProp('a', 'some value') ;
?>
Expected result:
----------------
ChildClass::$a == 'some value' ;
Actual result:
--------------
Fatal error: Access to undeclared static property: ParentClass::$a in
c:\phproot\static\bug.php5 on line 9
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29647&edit=1