Use of 'self' in static function in subclass

From: Date: Tue, 01 Jun 2004 13:11:29 +0000
Subject: Use of 'self' in static function in subclass
Groups: php.internals 
Request: Send a blank email to internals+get-10200@lists.php.net to get a copy of this message
Hi All, I have a class and a subclass, both with a static method: <?php class Foo { static function Bar() { self::Baz(); } } class Foo2 extends Foo { static function Baz() { echo 'Baz'; } } Foo2::Bar(); ?> In this case I expect to find 'Baz' on my screen, but I get the following: "Fatal error: Call to undefined method Foo::baz() in d:\htdocs_php5\ProBase2\TRUNK\probase\libsys\test5.php on line 7". This is in PHP5 RC2. Somehow this behaviour seems logical, on the other hand I don't think it's desired. I think that 'self' should point to the current class, even if the static method resides in a parent class. Is this 'self'-behaviour intended? Bert

« previous php.internals (#10200) next »