Skip to content

Commit

Permalink
FIX Removes version checking for LSB in Object::static_lookup()
Browse files Browse the repository at this point in the history
Late static binding was added in PHP 5.3, not 5.4. As such, the check for 5.4
and then fallback to Reflection isn't needed.
  • Loading branch information
simonwelsh committed Aug 23, 2012
1 parent 87685ee commit e159a68
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions core/Object.php
Expand Up @@ -274,16 +274,14 @@ public static function getCustomClass($class) {
* Get the value of a static property of a class, even in that property is declared protected (but not private), without any inheritance,
* merging or parent lookup if it doesn't exist on the given class.
*
* If using PHP 5.4, we can do this using $foo::$bar syntax. PHP 5.3 uses ReflectionClass to get the static properties instead.
*
* @static
* @param $class - The class to get the static from
* @param $name - The property to get from the class
* @param null $default - The value to return if property doesn't exist on class
* @return any - The value of the static property $name on class $class, or $default if that property is not defined
*/
public static function static_lookup($class, $name, $default = null) {
if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4 && is_subclass_of($class, 'Object')) {
if (is_subclass_of($class, 'Object')) {
if (isset($class::$$name)) {
$parent = get_parent_class($class);
if (!$parent || !isset($parent::$$name) || $parent::$$name !== $class::$$name) return $class::$$name;
Expand Down
3 changes: 1 addition & 2 deletions tests/model/MySQLDatabaseTest.php
Expand Up @@ -17,7 +17,7 @@ function setUp() {
'MultiEnum3' => 'MultiEnum("A, B, C, D","A, B")',
);
}
$this->markTestSkipped('This test requires the Config API to be immutable');
parent::setUp();
}

Expand All @@ -27,7 +27,6 @@ function setUp() {
function testFieldsDontRerequestChanges() {
// These are MySQL specific :-S
if(DB::getConn() instanceof MySQLDatabase) {

$db = DB::getConn();
DB::quiet();

Expand Down

0 comments on commit e159a68

Please sign in to comment.