diff --git a/core/Object.php b/core/Object.php index 395acca12..d13ccc7ae 100755 --- a/core/Object.php +++ b/core/Object.php @@ -418,9 +418,12 @@ abstract class Object { // merge with existing static vars $extensions = self::uninherited_static($class, 'extensions'); + // We use unshift rather than push so that module extensions are added before built-in ones. // in particular, this ensures that the Versioned rewriting is done last. - array_unshift($extensions, $extension); + if($extensions) array_unshift($extensions, $extension); + else $extensions = array($extension); + self::set_static($class, 'extensions', $extensions); // load statics now for DataObject classes