Hello, On Tue, Oct 4, 2011 at 11:33 AM, Matthew Weier O'Phinney <weierophin...@php.net> wrote: > > That makes complete sense to me -- ClassA is referring to self, which > resolves to ClassA... which does not define a "VERSION" constant. Change > to this: > > public $version = static::VERSION; > > and it should be fine. >
Hi Matt, I knew what was wrong with the code as soon as I saw it :- ), the code itself was part of a much more complicated system and I was using it in a unexpected way. The reason it was difficult to troubleshoot is because the constant being whined about was not any (of the several) constants being evaluated at the line the error was for. I think the error should be thrown at compile time, not at runtime ONLY when a constant is being accessed. This could cause dangerous hard to catch errors that make it into production. In addition, as I understand and would like to make you aware that static is not allowed in compile time class constants. Which is slightly unusual and perhaps could be changed because it seems that there is already runtime resolving taking place here. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php