Bug with static property access

From: Date: Mon, 03 Oct 2011 20:26:04 +0000
Subject: Bug with static property access
Groups: php.internals 
Request: Send a blank email to internals+get-55696@lists.php.net to get a copy of this message
Hello, I noticed the following odd behavior earlier today, there is definitely a bug here in my opinion, the bug is either the error message or the behavior. I think the behavior is possibly expected. I'll let some others comment. The reason I think the error is odd is because it is very misleading in a much larger code base (what I was debugging) you go to the line it is complaining about and are perplexed because you are not attempting to access the mentioned constant. I'm sure the engine does some kind of lazy/runtime determination that causes this, that area may need a look at? Example: <?php abstract class ClassA { static protected $_cache = Array(); public $version = self::VERSION; final static public function MethodOne() { return __METHOD__; } final static public function MethodTwo() { self::$_cache; return __METHOD__; } } abstract class ClassB extends ClassA { const VERSION = 1; } var_dump(ClassB::MethodOne()); var_dump(ClassB::MethodTwo()); ?> // prints string(17) "ClassA::MethodOne" Fatal error: Undefined class constant 'self::VERSION' in <SNIP>/testbug.php on line 14

« previous php.internals (#55696) next »