From 20a837947faedb8d45f66792d948d77d39882770 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 4 May 2012 00:26:09 +0200 Subject: [PATCH] MINOR Using PHP version constants rather than version_compare() in Object::static_lookup(), since its called 10k times on an average CMS load that makes a difference of about 3% (with APC) --- core/Object.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/Object.php b/core/Object.php index d32bc20b8..03cb094f3 100755 --- a/core/Object.php +++ b/core/Object.php @@ -290,14 +290,13 @@ abstract class Object { * @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 (version_compare(PHP_VERSION, '5.4', '>=') && is_subclass_of($class, 'Object')) { + if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4 && 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; } return $default; - } - else { + } else { // TODO: This gets set once, then not updated, so any changes to statics after this is called the first time for any class won't be exposed static $static_properties = array();