Reflection and Late Static Binding
| Bug #60367 | Reflection and Late Static Binding | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2011-11-23 16:57 UTC | Modified: | 2011-11-24 09:18 UTC |
|
||||||||||
| From: | woody dot gilk at kohanaframework dot org | Assigned: | laruence (profile) | |||||||||||
| Status: | Closed | Package: | Scripting Engine problem | |||||||||||
| PHP Version: | 5.3.8 | OS: | OSX 10.6.8 | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2011-11-23 16:57 UTC] woody dot gilk at kohanaframework dot org
Description:
------------
When calling a method that exists only in the parent class with Reflection, the
incorrect class is used.
This bug is highly related to #53742, but has a different test case. The root
cause may be exactly the same.
Test script:
---------------
abstract class A {
const WHAT = 'wrong';
public static function call() {
echo static::WHAT;
}
}
class B extends A {
const WHAT = 'correct';
}
B::call();
$class = new ReflectionClass('B');
$class->getMethod('call')->invoke(null);
Expected result:
----------------
"correct"
Actual result:
--------------
"wrong"
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2013-04-03 20:26 UTC] david at orlandophp dot org