Hello, First, to be clear, you're mixing two kinds of static keywords: 1) a static method/property which represents a method/property that is bound to a class only 2) the "static" class reference
Of course, private properties (static or not) are not accessible from any other scope than the one in which they are defined. In this context, static::$cls is translated to B::$cls, and will issue an error as B::$cls is not accessible from A's scope. Regards On Dec 15, 2007 12:07 AM, Michael J. I. Jackson <[EMAIL PROTECTED]> wrote: > Hello all, > > I'm playing around with 5.3, and I noticed the following interesting > behavior: > > > class A > { > > private static $cls = __CLASS__; > > public static function who() > { > print static::$cls; > } > > } > > class B extends A > { > > private static $cls = __CLASS__; > > } > > B::who(); // Fatal error: Cannot access private property B::$cls > > I understand why this is happening, but IMO, this should not be > throwing an error. If "static" is supposed to be referencing the > "called class", we need a way to access ALL of the variables of that > class from its parent classes. Otherwise, there is no way to create > static class variables that won't be inherited in a hierarchy. If > there is, and I'm missing it, please forgive me and point it out. > > Regards, > > Michael > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- Etienne Kneuss http://www.colder.ch Men never do evil so completely and cheerfully as when they do it from a religious conviction. -- Pascal