|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-08-13 12:17 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 16 06:00:02 2025 UTC |
It does. abstract class ParentClass { static public function modifyStaticProp($propName, $propValue) { self::${$propName} = $propValue ; } } There is only one class, the class itself, aka ParentClass.