ID: 46870 Updated by: [email protected] Reported By: alvin at livejournal dot dk -Status: Open +Status: Closed Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 5.2.8 New Comment:
As of PHP5.3 you can use static:: (see http://php.net/lsb) Previous Comments: ------------------------------------------------------------------------ [2008-12-15 23:26:32] crrodriguez at opensuse dot org looks like expected behavior...self::BAR is not defined, self::BAR refers to the same __class__ constant "BAR" not to the __instance__ in this case. ------------------------------------------------------------------------ [2008-12-15 15:30:43] alvin at livejournal dot dk Description: ------------ If an abstract class attempts to access a class constant defined by its parent, a fatal error is issued. Reproduce code: --------------- <?php abstract class A { public function foo () { echo $this->bar; //works echo self::BAR; //fatal error } } class B extends A { public $bar = 'foovar'; const BAR = 'fooconst'; } $x = new B; $x->foo(); ?> Expected result: ---------------- foovarfooconst Actual result: -------------- foovar Fatal error: Undefined class constant 'BAR' in... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46870&edit=1
