Hi Keven,
First, I don't see any late static binding being used here. LSB only
applies when you access a static member using the static keyword within a
class method. This code uses static properties but accesses them directly
without going through class methods. Here's an example of LSB:
class Foo
{
static $my_var = 'The Foo';
static function dump() {
echo static::$my_var . "\n"; // Use Foo's or Bar's depending
on what appears before ::dump()
}
}
class Bar extends Foo
{
static $my_var = 'The Bar';
}
Bar::dump(); // The Bar
Foo::dump(); // The Foo
Here Foo::dump() uses LSB to pick the source of $my_var.
That being said, what you're seeing does look like a change (or bug) in how
PHP accesses constants. Given that it is order-dependent, my guess is that
5.4 introduced a bug that causes Bar to push its constant up into Foo. The
strange thing is that the constant is compiled into the class, and since
Bar extends Foo I would expect Foo to be compiled first regardless of the
order in which you access the static variable later.
David