From 9103816333e790a9b7cd84994e00e0941e34de39 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Thu, 30 Nov 2017 17:49:46 +0000 Subject: [PATCH 1/3] NEW Add php 7.2 support --- .travis.yml | 2 + _config.php | 4 +- admin/code/CMSBatchAction.php | 2 +- admin/code/CMSMenu.php | 2 +- admin/code/CMSMenuItem.php | 2 +- admin/code/LeftAndMain.php | 4 +- admin/code/ModelAdmin.php | 4 +- api/DataFormatter.php | 2 +- api/XMLDataFormatter.php | 2 +- composer.json | 4 +- control/ContentNegotiator.php | 2 +- control/Controller.php | 2 +- control/RequestHandler.php | 2 +- control/injector/AfterCallAspect.php | 2 +- control/injector/BeforeCallAspect.php | 2 +- control/injector/Injector.php | 6 +- .../injector/SilverStripeInjectionCreator.php | 2 +- core/ClassInfo.php | 6 +- core/Config.php | 6 +- core/Convert.php | 2 +- core/Core.php | 2 +- core/Diff.php | 4 +- core/Extension.php | 6 +- core/HTMLCleaner.php | 2 +- core/Object.php | 24 +++--- core/compat/Object.php | 5 ++ core/manifest/ClassManifest.php | 2 +- core/manifest/ConfigStaticManifest.php | 2 +- dev/Backtrace.php | 2 +- dev/BuildTask.php | 2 +- dev/BulkLoader.php | 2 +- dev/CSSContentParser.php | 2 +- dev/CSVParser.php | 2 +- dev/Cli.php | 2 +- dev/DebugView.php | 4 +- dev/Log.php | 8 +- dev/YamlFixture.php | 2 +- dev/ZendLog.php | 2 +- email/Mailer.php | 2 +- filesystem/File.php | 2 +- filesystem/FileFinder.php | 2 +- filesystem/FileNameFilter.php | 2 +- filesystem/Filesystem.php | 2 +- filesystem/GD.php | 2 +- filesystem/Upload.php | 2 +- forms/CompositeField.php | 2 +- forms/DateField.php | 2 +- forms/FileField.php | 2 +- forms/FormScaffolder.php | 6 +- forms/FormTransformation.php | 2 +- forms/HtmlEditorField.php | 2 +- forms/UploadField.php | 2 +- forms/Validator.php | 2 +- forms/gridfield/GridFieldConfig.php | 2 +- forms/gridfield/GridFieldDetailForm.php | 6 +- forms/gridfield/GridFieldLevelup.php | 2 +- forms/gridfield/GridFieldSortableHeader.php | 2 +- forms/gridfield/GridState.php | 2 +- i18n/i18n.php | 2 +- i18n/i18nTextCollector.php | 2 +- model/ArrayList.php | 16 ++-- model/DataObject.php | 6 +- model/DataQuery.php | 2 +- model/ManyManyList.php | 6 +- model/Transliterator.php | 2 +- model/URLSegmentFilter.php | 2 +- model/UnsavedRelationList.php | 2 +- model/ValidationResult.php | 2 +- model/connect/DBSchemaManager.php | 2 +- model/connect/MySQLiConnector.php | 2 +- model/connect/PDOConnector.php | 2 +- model/fieldtypes/DBField.php | 2 +- model/fieldtypes/compat/autoload.php | 24 ++++-- parsers/SQLFormatter.php | 2 +- parsers/ShortcodeParser.php | 2 +- parsers/TextParser.php | 2 +- search/SearchContext.php | 2 +- search/filters/SearchFilter.php | 2 +- security/Authenticator.php | 2 +- security/PasswordValidator.php | 2 +- security/Security.php | 2 +- security/SecurityToken.php | 2 +- .../Framework/Injector/Factory.php | 2 +- tests/core/ClassInfoTest.php | 8 +- tests/core/ConfigTest.php | 20 ++--- tests/core/ObjectTest.php | 80 +++++++++---------- .../i18nothermodule/code/i18nOtherModule.php | 2 +- .../i18ntestmodule/code/i18nTestModule.php | 2 +- .../code/subfolder/i18nTestSubModule.php | 2 +- tests/i18n/i18nTest.php | 2 +- tests/injector/InjectorTest.php | 2 +- tests/model/ManyManyListExtensionTest.php | 2 +- tests/security/MemberTest.php | 6 +- thirdparty/Zend/Currency.php | 2 +- thirdparty/Zend/Loader/Autoloader.php | 6 +- .../Zend/Loader/Autoloader/Resource.php | 2 +- thirdparty/Zend/Log.php | 2 +- thirdparty/simpletest/compatibility.php | 6 +- .../classes/utils/JSON.php | 4 +- view/ArrayData.php | 2 +- view/SSViewer.php | 10 +-- view/ViewableData.php | 8 +- 102 files changed, 230 insertions(+), 215 deletions(-) mode change 100755 => 100644 core/Object.php create mode 100644 core/compat/Object.php diff --git a/.travis.yml b/.travis.yml index b42b4e492..986445dcf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,8 @@ addons: matrix: include: + - php: 7.2 + env: DB=MYSQL PDO=1 - php: 5.3 env: DB=MYSQL - php: 5.4 diff --git a/_config.php b/_config.php index 69b95fb55..39e29e576 100644 --- a/_config.php +++ b/_config.php @@ -23,8 +23,8 @@ * * Overload both of these to support legacy code. */ -Object::useCustomClass('SSDatetime', 'SS_Datetime', true); -Object::useCustomClass('Datetime', 'SS_Datetime', true); +SS_Object::useCustomClass('SSDatetime', 'SS_Datetime', true); +SS_Object::useCustomClass('Datetime', 'SS_Datetime', true); /** * The root directory of TinyMCE diff --git a/admin/code/CMSBatchAction.php b/admin/code/CMSBatchAction.php index 512503a62..9dff9b261 100644 --- a/admin/code/CMSBatchAction.php +++ b/admin/code/CMSBatchAction.php @@ -13,7 +13,7 @@ * @package framework * @subpackage admin */ -abstract class CMSBatchAction extends Object { +abstract class CMSBatchAction extends SS_Object { protected $managedClass = 'SiteTree'; diff --git a/admin/code/CMSMenu.php b/admin/code/CMSMenu.php index a019575c7..302687ff6 100644 --- a/admin/code/CMSMenu.php +++ b/admin/code/CMSMenu.php @@ -15,7 +15,7 @@ * @package framework * @subpackage admin */ -class CMSMenu extends Object implements IteratorAggregate, i18nEntityProvider { +class CMSMenu extends SS_Object implements IteratorAggregate, i18nEntityProvider { /** * An array of changes to be made to the menu items, in the order that the changes should be diff --git a/admin/code/CMSMenuItem.php b/admin/code/CMSMenuItem.php index 1eb59a26d..268e1df64 100644 --- a/admin/code/CMSMenuItem.php +++ b/admin/code/CMSMenuItem.php @@ -11,7 +11,7 @@ * @package framework * @subpackage admin */ -class CMSMenuItem extends Object { +class CMSMenuItem extends SS_Object { /** * The (translated) menu title diff --git a/admin/code/LeftAndMain.php b/admin/code/LeftAndMain.php index 34eb7143e..78d37512d 100644 --- a/admin/code/LeftAndMain.php +++ b/admin/code/LeftAndMain.php @@ -1891,7 +1891,7 @@ class LeftAndMain_TreeNode extends ViewableData { /** * Object represented by this node * - * @var Object + * @var SS_Object */ protected $obj; @@ -1924,7 +1924,7 @@ class LeftAndMain_TreeNode extends ViewableData { protected $filter; /** - * @param Object $obj + * @param SS_Object $obj * @param string $link * @param bool $isCurrent * @param string $numChildrenMethod diff --git a/admin/code/ModelAdmin.php b/admin/code/ModelAdmin.php index a8931d263..99e1d4c16 100644 --- a/admin/code/ModelAdmin.php +++ b/admin/code/ModelAdmin.php @@ -201,9 +201,9 @@ abstract class ModelAdmin extends LeftAndMain { $form = new Form($this, "SearchForm", $context->getSearchFields(), new FieldList( - Object::create('FormAction', 'search', _t('MemberTableField.APPLY_FILTER', 'Apply Filter')) + SS_Object::create('FormAction', 'search', _t('MemberTableField.APPLY_FILTER', 'Apply Filter')) ->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive'), - Object::create('ResetFormAction','clearsearch', _t('ModelAdmin.RESET','Reset')) + SS_Object::create('ResetFormAction','clearsearch', _t('ModelAdmin.RESET','Reset')) ->setUseButtonTag(true) ), new RequiredFields() diff --git a/api/DataFormatter.php b/api/DataFormatter.php index 1d3b7ecef..d8eda0949 100644 --- a/api/DataFormatter.php +++ b/api/DataFormatter.php @@ -6,7 +6,7 @@ * @package framework * @subpackage formatters */ -abstract class DataFormatter extends Object { +abstract class DataFormatter extends SS_Object { /** * Set priority from 0-100. diff --git a/api/XMLDataFormatter.php b/api/XMLDataFormatter.php index 2cb848639..2b0f75552 100644 --- a/api/XMLDataFormatter.php +++ b/api/XMLDataFormatter.php @@ -54,7 +54,7 @@ class XMLDataFormatter extends DataFormatter { $fieldValue = $obj->obj($fieldName)->forTemplate(); if(!mb_check_encoding($fieldValue,'utf-8')) $fieldValue = "(data is badly encoded)"; - if(is_object($fieldValue) && is_subclass_of($fieldValue, 'Object') && $fieldValue->hasMethod('toXML')) { + if(is_object($fieldValue) && is_subclass_of($fieldValue, 'SS_Object') && $fieldValue->hasMethod('toXML')) { $xml .= $fieldValue->toXML(); } else { if('HTMLText' == $fieldType) { diff --git a/composer.json b/composer.json index 794e8d4db..5a3ad3f9f 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">= 5.3.3, <7.2", + "php": "^5.3.3 || ^7", "composer/installers": "~1.0", "mustangostang/spyc": "^0.6.2" }, @@ -40,7 +40,7 @@ "thirdparty/php-peg", "thirdparty/simpletest", "thirdparty/zend_translate_railsyaml" ], "exclude-from-classmap": [ - "view/SSTemplateParser.php.inc", "dev/phpunit/PhpUnitWrapper.php", "model/fieldtypes/compat" + "view/SSTemplateParser.php.inc", "dev/phpunit/PhpUnitWrapper.php", "model/fieldtypes/compat", "core/compat" ] } } diff --git a/control/ContentNegotiator.php b/control/ContentNegotiator.php index c34e47171..3ae2330de 100644 --- a/control/ContentNegotiator.php +++ b/control/ContentNegotiator.php @@ -26,7 +26,7 @@ * devs might know what they're doing and don't want contentnegotiator messing with their HTML4 doctypes, * but still find it useful to have self-closing tags removed. */ -class ContentNegotiator extends Object { +class ContentNegotiator extends SS_Object { /** * @config diff --git a/control/Controller.php b/control/Controller.php index 2f8095a17..9a3012d49 100644 --- a/control/Controller.php +++ b/control/Controller.php @@ -165,7 +165,7 @@ class Controller extends RequestHandler implements TemplateGlobalProvider { $this->setResponse($response); } else { - if($body instanceof Object && $body->hasMethod('getViewer')) { + if($body instanceof SS_Object && $body->hasMethod('getViewer')) { if(isset($_REQUEST['debug_request'])) { Debug::message("Request handler $body->class object to $this->class controller;" . "rendering with template returned by $body->class::getViewer()"); diff --git a/control/RequestHandler.php b/control/RequestHandler.php index 17ffe4ab8..429c2aa28 100644 --- a/control/RequestHandler.php +++ b/control/RequestHandler.php @@ -422,7 +422,7 @@ class RequestHandler extends ViewableData { $isAllowed = true; } elseif(substr($test, 0, 2) == '->') { // Determined by custom method with "->" prefix - list($method, $arguments) = Object::parse_class_spec(substr($test, 2)); + list($method, $arguments) = SS_Object::parse_class_spec(substr($test, 2)); $isAllowed = call_user_func_array(array($this, $method), $arguments); } else { // Value is a permission code to check the current member against diff --git a/control/injector/AfterCallAspect.php b/control/injector/AfterCallAspect.php index baabc8db3..7017703f7 100644 --- a/control/injector/AfterCallAspect.php +++ b/control/injector/AfterCallAspect.php @@ -16,7 +16,7 @@ interface AfterCallAspect { /** * Call this aspect after a method is executed * - * @param object $proxied + * @param SS_Object $proxied * The object having the method called upon it. * @param string $method * The name of the method being called diff --git a/control/injector/BeforeCallAspect.php b/control/injector/BeforeCallAspect.php index 0ec0c0e71..e7bd21f10 100644 --- a/control/injector/BeforeCallAspect.php +++ b/control/injector/BeforeCallAspect.php @@ -14,7 +14,7 @@ interface BeforeCallAspect { /** * Call this aspect before a method is executed * - * @param object $proxied + * @param SS_Object $proxied * The object having the method called upon it. * @param string $method * The name of the method being called diff --git a/control/injector/Injector.php b/control/injector/Injector.php index 1c247b35e..6dcafbcaa 100644 --- a/control/injector/Injector.php +++ b/control/injector/Injector.php @@ -356,7 +356,7 @@ class Injector { * * @param string $property * the name of the property - * @param object $object + * @param SS_Object $object * the object to be set */ public function addAutoProperty($property, $object) { @@ -585,7 +585,7 @@ class Injector { * into them, so we can update that binding at a later point if needbe (ie * if the managed service changes) * - * @param object $object + * @param SS_Object $object * The object to inject * @param string $asType * The ID this item was loaded as. This is so that the property configuration @@ -694,7 +694,7 @@ class Injector { /** * Helper to set a property's value * - * @param object $object + * @param SS_Object $object * Set an object's property to a specific value * @param string $name * The name of the property to set diff --git a/control/injector/SilverStripeInjectionCreator.php b/control/injector/SilverStripeInjectionCreator.php index f4e454960..4e222637f 100644 --- a/control/injector/SilverStripeInjectionCreator.php +++ b/control/injector/SilverStripeInjectionCreator.php @@ -9,7 +9,7 @@ use SilverStripe\Framework\Injector\Factory; class SilverStripeInjectionCreator implements Factory { public function create($class, array $params = array()) { - $class = Object::getCustomClass($class); + $class = SS_Object::getCustomClass($class); $reflector = new ReflectionClass($class); return $params ? $reflector->newInstanceArgs($params) : $reflector->newInstance(); diff --git a/core/ClassInfo.php b/core/ClassInfo.php index fdd1e18c4..42b241d0c 100644 --- a/core/ClassInfo.php +++ b/core/ClassInfo.php @@ -76,7 +76,7 @@ class ClassInfo { * Returns an array of the current class and all its ancestors and children * which require a DB table. * - * @param string|object $class + * @param string|SS_Object $class * @todo Move this into data object * @return array */ @@ -103,7 +103,7 @@ class ClassInfo { * Returns the root class (the first to extend from DataObject) for the * passed class. * - * @param string|object $class + * @param string|SS_Object $class * @return string */ public static function baseDataClass($class) { @@ -162,7 +162,7 @@ class ClassInfo { * * eg: self::class_name('dataobJEct'); //returns 'DataObject' * - * @param string|object $nameOrObject The classname or object you want to normalise + * @param string|SS_Object $nameOrObject The classname or object you want to normalise * * @return string The normalised class name */ diff --git a/core/Config.php b/core/Config.php index 5a553741b..01636d494 100644 --- a/core/Config.php +++ b/core/Config.php @@ -77,7 +77,7 @@ class Config { * A marker instance for the "anything" singleton value. Don't access * directly, even in-class, always use self::anything() * - * @var Object + * @var SS_Object */ private static $_anything = null; @@ -85,7 +85,7 @@ class Config { * Get a marker class instance that is used to do a "remove anything with * this key" by adding $key => Config::anything() to the suppress array * - * @return Object + * @return SS_Object */ public static function anything() { if (self::$_anything === null) { @@ -515,7 +515,7 @@ class Config { if (($sourceOptions & self::EXCLUDE_EXTRA_SOURCES) != self::EXCLUDE_EXTRA_SOURCES) { // If we don't have a fresh list of extra sources, get it from the class itself if (!array_key_exists($class, $this->extraConfigSources)) { - $this->extraConfigSources[$class] = Object::get_extra_config_sources($class); + $this->extraConfigSources[$class] = SS_Object::get_extra_config_sources($class); } // Update $sources with any extra sources diff --git a/core/Convert.php b/core/Convert.php index cc7629207..7e74cd66d 100644 --- a/core/Convert.php +++ b/core/Convert.php @@ -214,7 +214,7 @@ class Convert { * Convert a JSON encoded string into an object. * * @param string $val - * @return object|boolean + * @return SS_Object|boolean */ public static function json2obj($val) { return json_decode($val); diff --git a/core/Core.php b/core/Core.php index a78f5de75..0e774010a 100644 --- a/core/Core.php +++ b/core/Core.php @@ -158,7 +158,7 @@ Debug::loadErrorHandlers(); * data (e.g. the custom SilverStripe static handling). * * @param string $className - * @return Object + * @return SS_Object */ function singleton($className) { if($className == "Config") user_error("Don't pass Config to singleton()", E_USER_ERROR); diff --git a/core/Diff.php b/core/Diff.php index dc4a05070..cab862dc3 100644 --- a/core/Diff.php +++ b/core/Diff.php @@ -549,7 +549,7 @@ class Diff * * $diff = new Diff($lines1, $lines2); * $rev = $diff->reverse(); - * @return object A Diff object representing the inverse of the + * @return SS_Object A Diff object representing the inverse of the * original diff. */ public function reverse () { @@ -665,7 +665,7 @@ class Diff * by passing through DomDocument::loadHTML and saveXML * * @param string $content HTML content - * @param object $cleaner Optional instance of a HTMLCleaner class to + * @param SS_Object $cleaner Optional instance of a HTMLCleaner class to * use, overriding self::$html_cleaner_class */ public static function cleanHTML($content, $cleaner=null) { diff --git a/core/Extension.php b/core/Extension.php index 57e1ca3b4..3eaa3c260 100644 --- a/core/Extension.php +++ b/core/Extension.php @@ -21,7 +21,7 @@ abstract class Extension { /** * The object this extension is applied to. * - * @var Object + * @var SS_Object */ protected $owner; @@ -55,7 +55,7 @@ abstract class Extension { /** * Set the owner of this extension. - * @param Object $owner The owner object, + * @param SS_Object $owner The owner object, * @param string $ownerBaseClass The base class that the extension is applied to; this may be * the class of owner, or it may be a parent. For example, if Versioned was applied to SiteTree, * and then a Page object was instantiated, $owner would be a Page object, but $ownerBaseClass @@ -78,7 +78,7 @@ abstract class Extension { /** * Returns the owner of this extension. * - * @return Object + * @return SS_Object */ public function getOwner() { return $this->owner; diff --git a/core/HTMLCleaner.php b/core/HTMLCleaner.php index cc1274e45..9a5ddb930 100644 --- a/core/HTMLCleaner.php +++ b/core/HTMLCleaner.php @@ -7,7 +7,7 @@ /** * Base class for HTML cleaning implementations. */ -abstract class HTMLCleaner extends Object { +abstract class HTMLCleaner extends SS_Object { /** * @var array diff --git a/core/Object.php b/core/Object.php old mode 100755 new mode 100644 index a17f461b2..99b9bb395 --- a/core/Object.php +++ b/core/Object.php @@ -14,7 +14,7 @@ * @package framework * @subpackage core */ -abstract class Object { +abstract class SS_Object { /** * An array of extension names and parameters to be applied to this object upon construction. @@ -135,7 +135,7 @@ abstract class Object { // Class to create should be the calling class if not Object, // otherwise the first parameter $class = get_called_class(); - if($class == 'Object') $class = array_shift($args); + if($class == 'SS_Object' || $class == 'Object') $class = array_shift($args); $class = self::getCustomClass($class); @@ -158,7 +158,7 @@ abstract class Object { // Singleton to create should be the calling class if not Object, // otherwise the first parameter $class = get_called_class(); - if($class === 'Object') $class = array_shift($args); + if($class === 'SS_Object') $class = array_shift($args); return Injector::inst()->get($class); } @@ -192,8 +192,8 @@ abstract class Object { // an $extension value can contain parameters as a string, // e.g. "Versioned('Stage','Live')" if(strpos($classSpec,'(') === false) { - if($firstArg === null) self::$_cache_inst_args[$classSpec.$firstArg] = Object::create($classSpec); - else self::$_cache_inst_args[$classSpec.$firstArg] = Object::create($classSpec, $firstArg); + if($firstArg === null) self::$_cache_inst_args[$classSpec.$firstArg] = SS_Object::create($classSpec); + else self::$_cache_inst_args[$classSpec.$firstArg] = SS_Object::create($classSpec, $firstArg); } else { list($class, $args) = self::parse_class_spec($classSpec); @@ -201,7 +201,7 @@ abstract class Object { if($firstArg !== null) array_unshift($args, $firstArg); array_unshift($args, $class); - self::$_cache_inst_args[$classSpec.$firstArg] = call_user_func_array(array('Object','create'), $args); + self::$_cache_inst_args[$classSpec.$firstArg] = call_user_func_array(array('SS_Object','create'), $args); } } @@ -394,7 +394,7 @@ abstract class Object { * defined */ public static function static_lookup($class, $name, $default = null) { - if (is_subclass_of($class, 'Object')) { + if (is_subclass_of($class, 'SS_Object')) { if (isset($class::$$name)) { $parent = get_parent_class($class); if (!$parent || !isset($parent::$$name) || $parent::$$name !== $class::$$name) return $class::$$name; @@ -653,7 +653,7 @@ abstract class Object { // -------------------------------------------------------------------------------------------------------------- - private static $unextendable_classes = array('Object', 'ViewableData', 'RequestHandler'); + private static $unextendable_classes = array('SS_Object', 'ViewableData', 'RequestHandler'); static public function get_extra_config_sources($class = null) { if($class === null) $class = get_called_class(); @@ -840,7 +840,7 @@ abstract class Object { } /** - * @param object $extension + * @param SS_Object $extension * @return array */ protected function findMethodsFromExtension($extension) { @@ -957,21 +957,21 @@ abstract class Object { // -------------------------------------------------------------------------------------------------------------- /** - * @see Object::get_static() + * @see SS_Object::get_static() */ public function stat($name, $uncached = false) { return Config::inst()->get(($this->class ? $this->class : get_class($this)), $name, Config::FIRST_SET); } /** - * @see Object::set_static() + * @see SS_Object::set_static() */ public function set_stat($name, $value) { Config::inst()->update(($this->class ? $this->class : get_class($this)), $name, $value); } /** - * @see Object::uninherited_static() + * @see SS_Object::uninherited_static() */ public function uninherited($name) { return Config::inst()->get(($this->class ? $this->class : get_class($this)), $name, Config::UNINHERITED); diff --git a/core/compat/Object.php b/core/compat/Object.php new file mode 100644 index 000000000..90b1df0fa --- /dev/null +++ b/core/compat/Object.php @@ -0,0 +1,5 @@ +@silverstripe.com) */ -class BulkLoader_Result extends Object { +class BulkLoader_Result extends SS_Object { /** * @var array Stores a map of ID and ClassNames diff --git a/dev/CSSContentParser.php b/dev/CSSContentParser.php index 690b164a0..45f74db7a 100644 --- a/dev/CSSContentParser.php +++ b/dev/CSSContentParser.php @@ -18,7 +18,7 @@ * @package framework * @subpackage core */ -class CSSContentParser extends Object { +class CSSContentParser extends SS_Object { protected $simpleXML = null; public function __construct($content) { diff --git a/dev/CSVParser.php b/dev/CSVParser.php index 72861a048..5fa83046a 100644 --- a/dev/CSVParser.php +++ b/dev/CSVParser.php @@ -26,7 +26,7 @@ * @package framework * @subpackage bulkloading */ -class CSVParser extends Object implements Iterator { +class CSVParser extends SS_Object implements Iterator { /** * @var string $filename diff --git a/dev/Cli.php b/dev/Cli.php index 44bbb8e54..b3342a5eb 100644 --- a/dev/Cli.php +++ b/dev/Cli.php @@ -6,7 +6,7 @@ * @package framework * @subpackage dev */ -class SS_Cli extends Object { +class SS_Cli extends SS_Object { /** * Returns true if the current STDOUT supports the use of colour control codes. */ diff --git a/dev/DebugView.php b/dev/DebugView.php index 3ee580917..478cad719 100644 --- a/dev/DebugView.php +++ b/dev/DebugView.php @@ -11,7 +11,7 @@ * @package framework * @subpackage dev */ -class DebugView extends Object { +class DebugView extends SS_Object { /** * Column size to wrap long strings to @@ -215,7 +215,7 @@ class DebugView extends Object { /** * Outputs a variable in a user presentable way * - * @param object $val + * @param SS_Object $val * @param array $caller Caller information */ public function writeVariable($val, $caller) { diff --git a/dev/Log.php b/dev/Log.php index fe0c0ecaa..e051fffda 100644 --- a/dev/Log.php +++ b/dev/Log.php @@ -61,7 +61,7 @@ class SS_Log { /** * @see SS_Log::get_logger() - * @var object + * @var SS_Object */ protected static $logger; @@ -86,7 +86,7 @@ class SS_Log { /** * Get the logger currently in use, or create a new one if it doesn't exist. * - * @return object + * @return SS_Object */ public static function get_logger() { if(!static::$logger) { @@ -122,7 +122,7 @@ class SS_Log { /** * Remove a writer instance from the logger. - * @param object $writer Zend_Log_Writer_Abstract instance + * @param SS_Object $writer Zend_Log_Writer_Abstract instance */ public static function remove_writer($writer) { static::get_logger()->removeWriter($writer); @@ -130,7 +130,7 @@ class SS_Log { /** * Add a writer instance to the logger. - * @param object $writer Zend_Log_Writer_Abstract instance + * @param SS_Object $writer Zend_Log_Writer_Abstract instance * @param const $priority Priority. Possible values: SS_Log::ERR, SS_Log::WARN or SS_Log::NOTICE * @param $comparison Priority comparison operator. Acts on the integer values of the error * levels, where more serious errors are lower numbers. By default this is "=", which means only diff --git a/dev/YamlFixture.php b/dev/YamlFixture.php index c6eea991d..0d44a9a7e 100644 --- a/dev/YamlFixture.php +++ b/dev/YamlFixture.php @@ -65,7 +65,7 @@ * * @see http://code.google.com/p/spyc/ */ -class YamlFixture extends Object { +class YamlFixture extends SS_Object { /** * Absolute path to the .yml fixture file diff --git a/dev/ZendLog.php b/dev/ZendLog.php index fbcfd4451..312b8367a 100644 --- a/dev/ZendLog.php +++ b/dev/ZendLog.php @@ -23,7 +23,7 @@ class SS_ZendLog extends Zend_Log { /** * Remove a writer instance that exists in this logger. - * @param object Zend_Log_Writer_Abstract instance + * @param SS_Object Zend_Log_Writer_Abstract instance */ public function removeWriter($writer) { foreach($this->_writers as $index => $existingWriter) { diff --git a/email/Mailer.php b/email/Mailer.php index b45903fc8..802d872a2 100644 --- a/email/Mailer.php +++ b/email/Mailer.php @@ -7,7 +7,7 @@ * @package framework * @subpackage email */ -class Mailer extends Object { +class Mailer extends SS_Object { /** * Default encoding type for messages. Available options are: diff --git a/filesystem/File.php b/filesystem/File.php index ba639e5ed..b9c3392ad 100644 --- a/filesystem/File.php +++ b/filesystem/File.php @@ -185,7 +185,7 @@ class File extends DataObject { * Replace "[file_link id=n]" shortcode with an anchor tag or link to the file. * @param $arguments array Arguments to the shortcode * @param $content string Content of the returned link (optional) - * @param $parser object Specify a parser to parse the content (see {@link ShortCodeParser}) + * @param $parser SS_Object Specify a parser to parse the content (see {@link ShortCodeParser}) * @return string anchor HTML tag if content argument given, otherwise file path link */ public static function link_shortcode_handler($arguments, $content = null, $parser = null) { diff --git a/filesystem/FileFinder.php b/filesystem/FileFinder.php index 66a3e9ce7..698eb1405 100644 --- a/filesystem/FileFinder.php +++ b/filesystem/FileFinder.php @@ -70,7 +70,7 @@ class SS_FileFinder { // We build our options array ourselves, because possibly no class or config manifest exists at this point do { - $this->options = array_merge(Object::static_lookup($class, 'default_options'), $this->options); + $this->options = array_merge(SS_Object::static_lookup($class, 'default_options'), $this->options); } while ($class = get_parent_class($class)); } diff --git a/filesystem/FileNameFilter.php b/filesystem/FileNameFilter.php index 2d33a1c09..df74b9447 100644 --- a/filesystem/FileNameFilter.php +++ b/filesystem/FileNameFilter.php @@ -27,7 +27,7 @@ * * See {@link URLSegmentFilter} for a more generic implementation. */ -class FileNameFilter extends Object { +class FileNameFilter extends SS_Object { /** * @config diff --git a/filesystem/Filesystem.php b/filesystem/Filesystem.php index e255fdc94..e7de3f419 100644 --- a/filesystem/Filesystem.php +++ b/filesystem/Filesystem.php @@ -5,7 +5,7 @@ * @package framework * @subpackage filesystem */ -class Filesystem extends Object { +class Filesystem extends SS_Object { /** * @config diff --git a/filesystem/GD.php b/filesystem/GD.php index 8e898d4b0..201d49528 100644 --- a/filesystem/GD.php +++ b/filesystem/GD.php @@ -4,7 +4,7 @@ * @package framework * @subpackage filesystem */ -class GDBackend extends Object implements Image_Backend { +class GDBackend extends SS_Object implements Image_Backend { protected $gd, $width, $height; protected $quality; protected $interlace; diff --git a/filesystem/Upload.php b/filesystem/Upload.php index 9ef532e20..4922ba0a1 100644 --- a/filesystem/Upload.php +++ b/filesystem/Upload.php @@ -102,7 +102,7 @@ class Upload extends Controller { * Set a different instance than {@link Upload_Validator} * for this upload session. * - * @param object $validator + * @param SS_Object $validator */ public function setValidator($validator) { $this->validator = $validator; diff --git a/forms/CompositeField.php b/forms/CompositeField.php index f137b25e1..8bf9657d6 100644 --- a/forms/CompositeField.php +++ b/forms/CompositeField.php @@ -58,7 +58,7 @@ class CompositeField extends FormField { // Skipping FormField::__construct(), but we have to make sure this // doesn't count as a broken constructor $this->brokenOnConstruct = false; - Object::__construct(); + SS_Object::__construct(); } /** diff --git a/forms/DateField.php b/forms/DateField.php index e8a182f13..da5fa86b6 100644 --- a/forms/DateField.php +++ b/forms/DateField.php @@ -514,7 +514,7 @@ class DateField_Disabled extends DateField { * @package framework * @subpackage forms */ -class DateField_View_JQuery extends Object { +class DateField_View_JQuery extends SS_Object { protected $field; diff --git a/forms/FileField.php b/forms/FileField.php index 2728539b9..eb36142cc 100644 --- a/forms/FileField.php +++ b/forms/FileField.php @@ -115,7 +115,7 @@ class FileField extends FormField { // assume that the file is connected via a has-one $hasOnes = $record->hasOne($this->name); // try to create a file matching the relation - $file = (is_string($hasOnes)) ? Object::create($hasOnes) : new $fileClass(); + $file = (is_string($hasOnes)) ? SS_Object::create($hasOnes) : new $fileClass(); } else if($record instanceof File) { $file = $record; } else { diff --git a/forms/FormScaffolder.php b/forms/FormScaffolder.php index 1fa632315..f91f6b79c 100644 --- a/forms/FormScaffolder.php +++ b/forms/FormScaffolder.php @@ -7,7 +7,7 @@ * @uses DBField::scaffoldFormField() * @uses DataObject::fieldLabels() */ -class FormScaffolder extends Object { +class FormScaffolder extends SS_Object { /** * @var DataObject $obj The object defining the fields to be scaffolded @@ -131,7 +131,7 @@ class FormScaffolder extends Object { $fieldClass = (isset($this->fieldClasses[$relationship])) ? $this->fieldClasses[$relationship] : 'GridField'; - $grid = Object::create($fieldClass, + $grid = SS_Object::create($fieldClass, $relationship, $this->obj->fieldLabel($relationship), $this->obj->$relationship(), @@ -160,7 +160,7 @@ class FormScaffolder extends Object { ? $this->fieldClasses[$relationship] : 'GridField'; - $grid = Object::create($fieldClass, + $grid = SS_Object::create($fieldClass, $relationship, $this->obj->fieldLabel($relationship), $this->obj->$relationship(), diff --git a/forms/FormTransformation.php b/forms/FormTransformation.php index 7204300da..1f60bb4ec 100644 --- a/forms/FormTransformation.php +++ b/forms/FormTransformation.php @@ -13,7 +13,7 @@ * @package forms * @subpackage transformations */ -class FormTransformation extends Object { +class FormTransformation extends SS_Object { public function transform(FormField $field) { // Look for a performXXTransformation() method on the field itself. // performReadonlyTransformation() is a pretty commonly applied method. diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index 41ac49f49..c48096b09 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -367,7 +367,7 @@ class HtmlEditorField_Toolbar extends RequestHandler { $fromWeb->addExtraClass('content ss-uploadfield'); Requirements::css(FRAMEWORK_DIR . '/css/AssetUploadField.css'); - $computerUploadField = Object::create('UploadField', 'AssetUploadField', ''); + $computerUploadField = SS_Object::create('UploadField', 'AssetUploadField', ''); $computerUploadField->setConfig('previewMaxWidth', 40); $computerUploadField->setConfig('previewMaxHeight', 30); $computerUploadField->addExtraClass('ss-assetuploadfield'); diff --git a/forms/UploadField.php b/forms/UploadField.php index 164a24ac1..ccf1c4e33 100644 --- a/forms/UploadField.php +++ b/forms/UploadField.php @@ -1113,7 +1113,7 @@ class UploadField extends FileField { // to default if there is no automatic relation if ($relationClass = $this->getRelationAutosetClass(null)) { // Create new object explicitly. Otherwise rely on Upload::load to choose the class. - $fileObject = Object::create($relationClass); + $fileObject = SS_Object::create($relationClass); } // Get the uploaded file into a new file object. diff --git a/forms/Validator.php b/forms/Validator.php index 3c9c42348..4dfaea701 100644 --- a/forms/Validator.php +++ b/forms/Validator.php @@ -8,7 +8,7 @@ * @package forms * @subpackage validators */ -abstract class Validator extends Object { +abstract class Validator extends SS_Object { /** * @var Form $form diff --git a/forms/gridfield/GridFieldConfig.php b/forms/gridfield/GridFieldConfig.php index 7b9e63c9b..cf922c6bb 100644 --- a/forms/gridfield/GridFieldConfig.php +++ b/forms/gridfield/GridFieldConfig.php @@ -19,7 +19,7 @@ * @package forms * @subpackage fields-gridfield */ -class GridFieldConfig extends Object { +class GridFieldConfig extends SS_Object { /** * @var ArrayList diff --git a/forms/gridfield/GridFieldDetailForm.php b/forms/gridfield/GridFieldDetailForm.php index e2fd8c960..b67cd32b2 100644 --- a/forms/gridfield/GridFieldDetailForm.php +++ b/forms/gridfield/GridFieldDetailForm.php @@ -85,17 +85,17 @@ class GridFieldDetailForm implements GridField_URLHandler { if(is_numeric($request->param('ID'))) { $record = $gridField->getList()->byId($request->param("ID")); } else { - $record = Object::create($gridField->getModelClass()); + $record = SS_Object::create($gridField->getModelClass()); } $class = $this->getItemRequestClass(); - $handler = Object::create($class, $gridField, $this, $record, $requestHandler, $this->name); + $handler = SS_Object::create($class, $gridField, $this, $record, $requestHandler, $this->name); $handler->setTemplate($this->template); // if no validator has been set on the GridField and the record has a // CMS validator, use that. - if(!$this->getValidator() && (method_exists($record, 'getCMSValidator') || $record instanceof Object && $record->hasMethod('getCMSValidator'))) { + if(!$this->getValidator() && (method_exists($record, 'getCMSValidator') || $record instanceof SS_Object && $record->hasMethod('getCMSValidator'))) { $this->setValidator($record->getCMSValidator()); } diff --git a/forms/gridfield/GridFieldLevelup.php b/forms/gridfield/GridFieldLevelup.php index 1e1c5c2e8..b9086e59d 100644 --- a/forms/gridfield/GridFieldLevelup.php +++ b/forms/gridfield/GridFieldLevelup.php @@ -7,7 +7,7 @@ * @package forms * @subpackage fields-gridfield */ -class GridFieldLevelup extends Object implements GridField_HTMLProvider { +class GridFieldLevelup extends SS_Object implements GridField_HTMLProvider { /** * @var integer - the record id of the level up to diff --git a/forms/gridfield/GridFieldSortableHeader.php b/forms/gridfield/GridFieldSortableHeader.php index c0a9c1449..c803b2ce9 100644 --- a/forms/gridfield/GridFieldSortableHeader.php +++ b/forms/gridfield/GridFieldSortableHeader.php @@ -132,7 +132,7 @@ class GridFieldSortableHeader implements GridField_HTMLProvider, GridField_DataM $dir = 'desc'; } - $field = Object::create( + $field = SS_Object::create( 'GridField_FormAction', $gridField, 'SetOrder'.$fieldName, $title, "sort$dir", array('SortColumn' => $columnField) )->addExtraClass('ss-gridfield-sort'); diff --git a/forms/gridfield/GridState.php b/forms/gridfield/GridState.php index 8f159a0f4..f3372b03b 100644 --- a/forms/gridfield/GridState.php +++ b/forms/gridfield/GridState.php @@ -37,7 +37,7 @@ class GridState extends HiddenField { /** * @param mixed $d - * @return object + * @return SS_Object */ public static function array_to_object($d) { if(is_array($d)) { diff --git a/i18n/i18n.php b/i18n/i18n.php index e77621112..668a8bcaa 100644 --- a/i18n/i18n.php +++ b/i18n/i18n.php @@ -62,7 +62,7 @@ require_once 'i18nSSLegacyAdapter.php'; * @package framework * @subpackage misc */ -class i18n extends Object implements TemplateGlobalProvider, Flushable { +class i18n extends SS_Object implements TemplateGlobalProvider, Flushable { /** * This static variable is used to store the current defined locale. diff --git a/i18n/i18nTextCollector.php b/i18n/i18nTextCollector.php index faa8a0231..fdae499d2 100644 --- a/i18n/i18nTextCollector.php +++ b/i18n/i18nTextCollector.php @@ -25,7 +25,7 @@ * @uses i18nEntityProvider * @uses i18n */ -class i18nTextCollector extends Object { +class i18nTextCollector extends SS_Object { /** * Default (master) locale diff --git a/model/ArrayList.php b/model/ArrayList.php index 8b6b07bcb..bc482a91f 100644 --- a/model/ArrayList.php +++ b/model/ArrayList.php @@ -171,8 +171,8 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta /** * Replaces an item in this list with another item. * - * @param array|object $item - * @param array|object $with + * @param array|SS_Object $item + * @param array|SS_Object $with * @return void; */ public function replace($item, $with) { @@ -188,7 +188,7 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta * Merges with another array or list by pushing all the items in it onto the * end of this list. * - * @param array|object $with + * @param array|SS_Object $with */ public function merge($with) { foreach ($with as $item) $this->push($item); @@ -221,7 +221,7 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta /** * Pushes an item onto the end of this list. * - * @param array|object $item + * @param array|SS_Object $item */ public function push($item) { $this->items[] = $item; @@ -230,7 +230,7 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta /** * Pops the last element off the end of the list and returns it. * - * @return array|object + * @return array|SS_Object */ public function pop() { return array_pop($this->items); @@ -239,7 +239,7 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta /** * Add an item onto the beginning of the list. * - * @param array|object $item + * @param array|SS_Object $item */ public function unshift($item) { array_unshift($this->items, $item); @@ -248,7 +248,7 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta /** * Shifts the item off the beginning of the list and returns it. * - * @return array|object + * @return array|SS_Object */ public function shift() { return array_shift($this->items); @@ -725,7 +725,7 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta * Extracts a value from an item in the list, where the item is either an * object or array. * - * @param array|object $item + * @param array|SS_Object $item * @param string $key * @return mixed */ diff --git a/model/DataObject.php b/model/DataObject.php index ae4958ea9..0652a1854 100644 --- a/model/DataObject.php +++ b/model/DataObject.php @@ -2429,7 +2429,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity // Otherwise, we need to determine if this is a complex field if(self::is_composite_field($this->class, $field)) { $helper = $this->castingHelper($field); - $fieldObj = Object::create_from_string($helper, $field); + $fieldObj = SS_Object::create_from_string($helper, $field); $compositeFields = $fieldObj->compositeDatabaseFields(); foreach ($compositeFields as $compositeName => $compositeType) { @@ -2687,7 +2687,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity } $castingHelper = $this->castingHelper($fieldName); if($castingHelper) { - $fieldObj = Object::create_from_string($castingHelper, $fieldName); + $fieldObj = SS_Object::create_from_string($castingHelper, $fieldName); $fieldObj->setValue($val); $fieldObj->saveInto($this); } else { @@ -2999,7 +2999,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity // General casting information for items in $db } else if($helper = $this->db($fieldName)) { - $obj = Object::create_from_string($helper, $fieldName); + $obj = SS_Object::create_from_string($helper, $fieldName); $obj->setValue($this->$fieldName, $this->record, false); return $obj; diff --git a/model/DataQuery.php b/model/DataQuery.php index 0a720cd64..16676dd4b 100644 --- a/model/DataQuery.php +++ b/model/DataQuery.php @@ -514,7 +514,7 @@ class DataQuery { } if($compositeFields) foreach($compositeFields as $k => $v) { if((is_null($columns) || in_array($k, $columns)) && $v) { - $dbO = Object::create_from_string($v, $k); + $dbO = SS_Object::create_from_string($v, $k); $dbO->addToQuery($query); } } diff --git a/model/ManyManyList.php b/model/ManyManyList.php index bf586edc7..753b5e53e 100644 --- a/model/ManyManyList.php +++ b/model/ManyManyList.php @@ -86,7 +86,7 @@ class ManyManyList extends RelationList { $finalized = array(); foreach($this->extraFields as $field => $spec) { - $obj = Object::create_from_string($spec); + $obj = SS_Object::create_from_string($spec); if($obj instanceof CompositeDBField) { $this->_compositeExtraFields[$field] = array(); @@ -131,7 +131,7 @@ class ManyManyList extends RelationList { } } - $obj = Object::create_from_string($this->extraFields[$fieldName], $fieldName); + $obj = SS_Object::create_from_string($this->extraFields[$fieldName], $fieldName); $obj->setValue($value, null, false); $add[$fieldName] = $obj; @@ -253,7 +253,7 @@ class ManyManyList extends RelationList { foreach($this->extraFields as $fieldName => $fieldSpec) { // Skip fields without an assignment if(array_key_exists($fieldName, $extraFields)) { - $fieldObject = Object::create_from_string($fieldSpec, $fieldName); + $fieldObject = SS_Object::create_from_string($fieldSpec, $fieldName); $fieldObject->setValue($extraFields[$fieldName]); $fieldObject->writeToManipulation($manipulation[$this->joinTable]); } diff --git a/model/Transliterator.php b/model/Transliterator.php index a7a1fc952..82bbc9755 100644 --- a/model/Transliterator.php +++ b/model/Transliterator.php @@ -13,7 +13,7 @@ * @package framework * @subpackage model */ -class SS_Transliterator extends Object { +class SS_Transliterator extends SS_Object { /** * @config * @var boolean Allow the use of iconv() to perform transliteration. Set to false to disable. diff --git a/model/URLSegmentFilter.php b/model/URLSegmentFilter.php index 13d41c498..c38fcf68f 100644 --- a/model/URLSegmentFilter.php +++ b/model/URLSegmentFilter.php @@ -14,7 +14,7 @@ * * See {@link FileNameFilter} for similar implementation for filesystem-based URLs. */ -class URLSegmentFilter extends Object { +class URLSegmentFilter extends SS_Object { /** * @config diff --git a/model/UnsavedRelationList.php b/model/UnsavedRelationList.php index 35b17f327..09ed5fd9b 100644 --- a/model/UnsavedRelationList.php +++ b/model/UnsavedRelationList.php @@ -85,7 +85,7 @@ class UnsavedRelationList extends ArrayList { /** * Pushes an item onto the end of this list. * - * @param array|object $item + * @param array|SS_Object $item * @param array $extraFields */ public function push($item, $extraFields = null) { diff --git a/model/ValidationResult.php b/model/ValidationResult.php index b014d4b20..1695f7605 100644 --- a/model/ValidationResult.php +++ b/model/ValidationResult.php @@ -6,7 +6,7 @@ * @package framework * @subpackage core */ -class ValidationResult extends Object { +class ValidationResult extends SS_Object { /** * @var bool - is the result valid or not */ diff --git a/model/connect/DBSchemaManager.php b/model/connect/DBSchemaManager.php index 6e8497524..1be971bb8 100644 --- a/model/connect/DBSchemaManager.php +++ b/model/connect/DBSchemaManager.php @@ -342,7 +342,7 @@ abstract class DBSchemaManager { $fieldSpec = substr($fieldSpec, 0, $pos); } - $fieldObj = Object::create_from_string($fieldSpec, $fieldName); + $fieldObj = SS_Object::create_from_string($fieldSpec, $fieldName); $fieldObj->arrayValue = $arrayValue; $fieldObj->setTable($table); diff --git a/model/connect/MySQLiConnector.php b/model/connect/MySQLiConnector.php index 13af37003..c7a8f46f0 100644 --- a/model/connect/MySQLiConnector.php +++ b/model/connect/MySQLiConnector.php @@ -192,7 +192,7 @@ class MySQLiConnector extends DBConnector { case 'double': $types .= 'd'; break; - case 'object': // Allowed if the object or resource has a __toString method + case 'SS_Object': // Allowed if the object or resource has a __toString method case 'resource': case 'string': case 'NULL': // Take care that a where clause should use "where XX is null" not "where XX = null" diff --git a/model/connect/PDOConnector.php b/model/connect/PDOConnector.php index 699959194..4546550a0 100644 --- a/model/connect/PDOConnector.php +++ b/model/connect/PDOConnector.php @@ -286,7 +286,7 @@ class PDOConnector extends DBConnector { return PDO::PARAM_NULL; case 'integer': return PDO::PARAM_INT; - case 'object': // Allowed if the object or resource has a __toString method + case 'SS_Object': // Allowed if the object or resource has a __toString method case 'resource': case 'float': // Not actually returnable from get_type case 'double': diff --git a/model/fieldtypes/DBField.php b/model/fieldtypes/DBField.php index a86a55c79..8e0616857 100644 --- a/model/fieldtypes/DBField.php +++ b/model/fieldtypes/DBField.php @@ -85,7 +85,7 @@ abstract class DBField extends ViewableData { * @return DBField */ public static function create_field($className, $value, $name = null, $object = null) { - $dbField = Object::create($className, $name, $object); + $dbField = SS_Object::create($className, $name, $object); $dbField->setValue($value, null, false); return $dbField; diff --git a/model/fieldtypes/compat/autoload.php b/model/fieldtypes/compat/autoload.php index 838813b27..107dcb123 100644 --- a/model/fieldtypes/compat/autoload.php +++ b/model/fieldtypes/compat/autoload.php @@ -2,16 +2,24 @@ if (PHP_MAJOR_VERSION < 7) { spl_autoload_register('php5_compat_autoloader'); + spl_autoload_register('php7_compat_autoloader'); +} elseif (PHP_MAJOR_VERSION === 7 && PHP_MINOR_VERSION < 2) { + spl_autoload_register('php7_compat_autoloader'); } function php5_compat_autoloader($classname) { - $classMap = array( - "int" => "/framework/model/fieldtypes/compat/Int.php", - "float" => "/framework/model/fieldtypes/compat/Float.php", - ); - - $classname = strtolower($classname); - if(isset($classMap[$classname])) { - require_once BASE_PATH . $classMap[$classname]; + switch (strtolower($classname)) { + case 'int': + require_once BASE_PATH . '/framework/model/fieldtypes/compat/Int.php'; + break; + case 'float': + require_once BASE_PATH . '/framework/model/fieldtypes/compat/Float.php'; + break; + } +} + +function php7_compat_autoloader($classname) { + if (strcasecmp($classname, 'object') === 0) { + require_once BASE_PATH . '/framework/core/compat/Object.php'; } } diff --git a/parsers/SQLFormatter.php b/parsers/SQLFormatter.php index 512f6c431..2939f623e 100644 --- a/parsers/SQLFormatter.php +++ b/parsers/SQLFormatter.php @@ -9,7 +9,7 @@ * @subpackage parsers * @author Ingo Schommer, Silverstripe Ltd. (@silverstripe.com) */ -class SQLFormatter extends Object { +class SQLFormatter extends SS_Object { protected static $newline_before_tokens = array( 'SELECT', diff --git a/parsers/ShortcodeParser.php b/parsers/ShortcodeParser.php index ef0633756..138177bd3 100644 --- a/parsers/ShortcodeParser.php +++ b/parsers/ShortcodeParser.php @@ -9,7 +9,7 @@ * @package framework * @subpackage misc */ -class ShortcodeParser extends Object { +class ShortcodeParser extends SS_Object { public function img_shortcode($attrs) { return ""; diff --git a/parsers/TextParser.php b/parsers/TextParser.php index e09e1ebb0..8112b42e5 100644 --- a/parsers/TextParser.php +++ b/parsers/TextParser.php @@ -25,7 +25,7 @@ * @package framework * @subpackage misc */ -abstract class TextParser extends Object { +abstract class TextParser extends SS_Object { protected $content; /** diff --git a/search/SearchContext.php b/search/SearchContext.php index bc7078bc3..2114b783f 100644 --- a/search/SearchContext.php +++ b/search/SearchContext.php @@ -23,7 +23,7 @@ * @package framework * @subpackage search */ -class SearchContext extends Object { +class SearchContext extends SS_Object { /** * DataObject subclass to which search parameters relate to. diff --git a/search/filters/SearchFilter.php b/search/filters/SearchFilter.php index da5bea6ce..71f98ecff 100644 --- a/search/filters/SearchFilter.php +++ b/search/filters/SearchFilter.php @@ -8,7 +8,7 @@ * @package framework * @subpackage search */ -abstract class SearchFilter extends Object { +abstract class SearchFilter extends SS_Object { /** * @var string Classname of the inspected {@link DataObject} diff --git a/security/Authenticator.php b/security/Authenticator.php index b1b98f0e3..19f280d59 100644 --- a/security/Authenticator.php +++ b/security/Authenticator.php @@ -9,7 +9,7 @@ * @package framework * @subpackage security */ -abstract class Authenticator extends Object { +abstract class Authenticator extends SS_Object { /** * This variable holds all authenticators that should be used diff --git a/security/PasswordValidator.php b/security/PasswordValidator.php index bb6b1475c..ac433f583 100644 --- a/security/PasswordValidator.php +++ b/security/PasswordValidator.php @@ -15,7 +15,7 @@ * @package framework * @subpackage security */ -class PasswordValidator extends Object { +class PasswordValidator extends SS_Object { private static $character_strength_tests = array( 'lowercase' => '/[a-z]/', diff --git a/security/Security.php b/security/Security.php index a0f72fe32..12f71e6ff 100644 --- a/security/Security.php +++ b/security/Security.php @@ -770,7 +770,7 @@ class Security extends Controller implements TemplateGlobalProvider { * @return Form Returns the lost password form */ public function ChangePasswordForm() { - return Object::create('ChangePasswordForm', $this, 'ChangePasswordForm'); + return SS_Object::create('ChangePasswordForm', $this, 'ChangePasswordForm'); } /** diff --git a/security/SecurityToken.php b/security/SecurityToken.php index f53a76e37..c0be5c830 100644 --- a/security/SecurityToken.php +++ b/security/SecurityToken.php @@ -28,7 +28,7 @@ * * @todo Make token name form specific for additional forgery protection. */ -class SecurityToken extends Object implements TemplateGlobalProvider { +class SecurityToken extends SS_Object implements TemplateGlobalProvider { /** * @var String diff --git a/src/SilverStripe/Framework/Injector/Factory.php b/src/SilverStripe/Framework/Injector/Factory.php index 22d51fdef..9507eaad5 100644 --- a/src/SilverStripe/Framework/Injector/Factory.php +++ b/src/SilverStripe/Framework/Injector/Factory.php @@ -15,7 +15,7 @@ interface Factory { * * @param string $service The class name of the service. * @param array $params The constructor parameters. - * @return object The created service instances. + * @return SS_Object The created service instances. */ public function create($service, array $params = array()); diff --git a/tests/core/ClassInfoTest.php b/tests/core/ClassInfoTest.php index fd437f41e..10f68c214 100644 --- a/tests/core/ClassInfoTest.php +++ b/tests/core/ClassInfoTest.php @@ -20,8 +20,8 @@ class ClassInfoTest extends SapphireTest { } public function testExists() { - $this->assertTrue(ClassInfo::exists('Object')); - $this->assertTrue(ClassInfo::exists('object')); + $this->assertTrue(ClassInfo::exists('SS_Object')); + $this->assertTrue(ClassInfo::exists('SS_Object')); $this->assertTrue(ClassInfo::exists('ClassInfoTest')); $this->assertTrue(ClassInfo::exists('CLASSINFOTEST')); $this->assertTrue(ClassInfo::exists('stdClass')); @@ -97,7 +97,7 @@ class ClassInfoTest extends SapphireTest { public function testAncestry() { $ancestry = ClassInfo::ancestry('ClassInfoTest_ChildClass'); $expect = ArrayLib::valuekey(array( - 'Object', + 'SS_Object', 'ViewableData', 'DataObject', 'ClassInfoTest_BaseClass', @@ -191,7 +191,7 @@ class ClassInfoTest extends SapphireTest { ); $this->assertNull( - ClassInfo::table_for_object_field('Object', 'Title') + ClassInfo::table_for_object_field('SS_Object', 'Title') ); $this->assertNull( diff --git a/tests/core/ConfigTest.php b/tests/core/ConfigTest.php index d2f681f21..f4ae61d5e 100644 --- a/tests/core/ConfigTest.php +++ b/tests/core/ConfigTest.php @@ -1,6 +1,6 @@ assertEquals(Object::static_lookup('ConfigTest_DefinesFoo', 'foo'), 1); - $this->assertEquals(Object::static_lookup('ConfigTest_DefinesFoo', 'bar'), null); + $this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFoo', 'foo'), 1); + $this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFoo', 'bar'), null); - $this->assertEquals(Object::static_lookup('ConfigTest_DefinesBar', 'foo'), null); - $this->assertEquals(Object::static_lookup('ConfigTest_DefinesBar', 'bar'), 2); + $this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesBar', 'foo'), null); + $this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesBar', 'bar'), 2); - $this->assertEquals(Object::static_lookup('ConfigTest_DefinesFooAndBar', 'foo'), 3); - $this->assertEquals(Object::static_lookup('ConfigTest_DefinesFooAndBar', 'bar'), 3); + $this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFooAndBar', 'foo'), 3); + $this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFooAndBar', 'bar'), 3); - $this->assertEquals(Object::static_lookup('ConfigTest_DefinesFooDoesntExtendObject', 'foo'), 4); - $this->assertEquals(Object::static_lookup('ConfigTest_DefinesFooDoesntExtendObject', 'bar'), null); + $this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFooDoesntExtendObject', 'foo'), 4); + $this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFooDoesntExtendObject', 'bar'), null); } public function testForClass() { diff --git a/tests/core/ObjectTest.php b/tests/core/ObjectTest.php index 1e766a5fb..b21aee9c9 100644 --- a/tests/core/ObjectTest.php +++ b/tests/core/ObjectTest.php @@ -119,7 +119,7 @@ class ObjectTest extends SapphireTest { $createdObj = ObjectTest_CreateTest::create('arg1', 'arg2', array(), null, 'arg5'); $this->assertEquals($createdObj->constructArguments, array('arg1', 'arg2', array(), null, 'arg5')); - $strongObj = Object::strong_create('ObjectTest_CreateTest', 'arg1', 'arg2', array(), null, 'arg5'); + $strongObj = SS_Object::strong_create('ObjectTest_CreateTest', 'arg1', 'arg2', array(), null, 'arg5'); $this->assertEquals($strongObj->constructArguments, array('arg1', 'arg2', array(), null, 'arg5')); } @@ -135,18 +135,18 @@ class ObjectTest extends SapphireTest { $obj1 = ObjectTest_CreateTest::create(); $this->assertTrue($obj1 instanceof ObjectTest_CreateTest); - Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest2'); + SS_Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest2'); $obj2 = ObjectTest_CreateTest::create(); $this->assertTrue($obj2 instanceof ObjectTest_CreateTest2); - $obj2_2 = Object::strong_create('ObjectTest_CreateTest'); + $obj2_2 = SS_Object::strong_create('ObjectTest_CreateTest'); $this->assertTrue($obj2_2 instanceof ObjectTest_CreateTest); - Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest3', true); + SS_Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest3', true); $obj3 = ObjectTest_CreateTest::create(); $this->assertTrue($obj3 instanceof ObjectTest_CreateTest3); - $obj3_2 = Object::strong_create('ObjectTest_CreateTest'); + $obj3_2 = SS_Object::strong_create('ObjectTest_CreateTest'); $this->assertTrue($obj3_2 instanceof ObjectTest_CreateTest3); } @@ -162,14 +162,14 @@ class ObjectTest extends SapphireTest { public function testGetExtensions() { $this->assertEquals( - Object::get_extensions('ObjectTest_ExtensionTest'), + SS_Object::get_extensions('ObjectTest_ExtensionTest'), array( 'oBjEcTTEST_ExtendTest1', "ObjectTest_ExtendTest2", ) ); $this->assertEquals( - Object::get_extensions('ObjectTest_ExtensionTest', true), + SS_Object::get_extensions('ObjectTest_ExtensionTest', true), array( 'oBjEcTTEST_ExtendTest1', "ObjectTest_ExtendTest2('FOO', 'BAR')", @@ -317,7 +317,7 @@ class ObjectTest extends SapphireTest { ObjectTest_ExtensionRemoveTest::remove_extension('ObjectTest_ExtendTest2'); $this->assertFalse( - Object::has_extension('ObjectTest_ExtensionRemoveTest', 'ObjectTest_ExtendTest2'), + SS_Object::has_extension('ObjectTest_ExtensionRemoveTest', 'ObjectTest_ExtendTest2'), "Extension added through \$add_extension() are detected as removed in has_extension()" ); @@ -329,11 +329,11 @@ class ObjectTest extends SapphireTest { } public function testParentClass() { - $this->assertEquals(ObjectTest_MyObject::create()->parentClass(), 'Object'); + $this->assertEquals(ObjectTest_MyObject::create()->parentClass(), 'SS_Object'); } public function testIsA() { - $this->assertTrue(ObjectTest_MyObject::create() instanceof Object); + $this->assertTrue(ObjectTest_MyObject::create() instanceof SS_Object); $this->assertTrue(ObjectTest_MyObject::create() instanceof ObjectTest_MyObject); } @@ -402,84 +402,84 @@ class ObjectTest extends SapphireTest { // Simple case $this->assertEquals( array('Versioned',array('Stage', 'Live')), - Object::parse_class_spec("Versioned('Stage','Live')") + SS_Object::parse_class_spec("Versioned('Stage','Live')") ); // String with commas $this->assertEquals( array('Versioned',array('Stage,Live', 'Stage')), - Object::parse_class_spec("Versioned('Stage,Live','Stage')") + SS_Object::parse_class_spec("Versioned('Stage,Live','Stage')") ); // String with quotes $this->assertEquals( array('Versioned',array('Stage\'Stage,Live\'Live', 'Live')), - Object::parse_class_spec("Versioned('Stage\'Stage,Live\'Live','Live')") + SS_Object::parse_class_spec("Versioned('Stage\'Stage,Live\'Live','Live')") ); // True, false and null values $this->assertEquals( array('ClassName', array('string', true, array('string', false))), - Object::parse_class_spec('ClassName("string", true, array("string", false))') + SS_Object::parse_class_spec('ClassName("string", true, array("string", false))') ); $this->assertEquals( array('ClassName', array(true, false, null)), - Object::parse_class_spec('ClassName(true, false, null)') + SS_Object::parse_class_spec('ClassName(true, false, null)') ); // Array $this->assertEquals( array('Enum',array(array('Accepted', 'Pending', 'Declined', 'Unsubmitted'), 'Unsubmitted')), - Object::parse_class_spec("Enum(array('Accepted', 'Pending', 'Declined', 'Unsubmitted'), 'Unsubmitted')") + SS_Object::parse_class_spec("Enum(array('Accepted', 'Pending', 'Declined', 'Unsubmitted'), 'Unsubmitted')") ); // Nested array $this->assertEquals( array('Enum',array(array('Accepted', 'Pending', 'Declined', array('UnsubmittedA','UnsubmittedB')), 'Unsubmitted')), - Object::parse_class_spec( + SS_Object::parse_class_spec( "Enum(array('Accepted', 'Pending', 'Declined', array('UnsubmittedA','UnsubmittedB')), 'Unsubmitted')") ); // 5.4 Shorthand Array $this->assertEquals( array('Enum',array(array('Accepted', 'Pending', 'Declined', 'Unsubmitted'), 'Unsubmitted')), - Object::parse_class_spec("Enum(['Accepted', 'Pending', 'Declined', 'Unsubmitted'], 'Unsubmitted')") + SS_Object::parse_class_spec("Enum(['Accepted', 'Pending', 'Declined', 'Unsubmitted'], 'Unsubmitted')") ); // 5.4 Nested shorthand array $this->assertEquals( array('Enum',array(array('Accepted', 'Pending', 'Declined', array('UnsubmittedA','UnsubmittedB')), 'Unsubmitted')), - Object::parse_class_spec( + SS_Object::parse_class_spec( "Enum(['Accepted', 'Pending', 'Declined', ['UnsubmittedA','UnsubmittedB']], 'Unsubmitted')") ); // Associative array $this->assertEquals( array('Varchar', array(255, array('nullifyEmpty' => false))), - Object::parse_class_spec("Varchar(255, array('nullifyEmpty' => false))") + SS_Object::parse_class_spec("Varchar(255, array('nullifyEmpty' => false))") ); // Nested associative array $this->assertEquals( array('Test', array('string', array('nested' => array('foo' => 'bar')))), - Object::parse_class_spec("Test('string', array('nested' => array('foo' => 'bar')))") + SS_Object::parse_class_spec("Test('string', array('nested' => array('foo' => 'bar')))") ); // 5.4 shorthand associative array $this->assertEquals( array('Varchar', array(255, array('nullifyEmpty' => false))), - Object::parse_class_spec("Varchar(255, ['nullifyEmpty' => false])") + SS_Object::parse_class_spec("Varchar(255, ['nullifyEmpty' => false])") ); // 5.4 shorthand nested associative array $this->assertEquals( array('Test', array('string', array('nested' => array('foo' => 'bar')))), - Object::parse_class_spec("Test('string', ['nested' => ['foo' => 'bar']])") + SS_Object::parse_class_spec("Test('string', ['nested' => ['foo' => 'bar']])") ); // Namespaced class $this->assertEquals( array('Test\MyClass', array()), - Object::parse_class_spec('Test\MyClass') + SS_Object::parse_class_spec('Test\MyClass') ); // Fully qualified namespaced class $this->assertEquals( array('\Test\MyClass', array()), - Object::parse_class_spec('\Test\MyClass') + SS_Object::parse_class_spec('\Test\MyClass') ); } } @@ -488,7 +488,7 @@ class ObjectTest extends SapphireTest { * @ignore */ -class ObjectTest_T1A extends Object { +class ObjectTest_T1A extends SS_Object { public function testMethod() { return true; } @@ -497,19 +497,19 @@ class ObjectTest_T1A extends Object { } } -class ObjectTest_T1B extends Object { +class ObjectTest_T1B extends SS_Object { public function someMethod() { return true; } } -class ObjectTest_T1C extends Object { +class ObjectTest_T1C extends SS_Object { public function t1cMethod() { return true; } } -class ObjectTest_T2 extends Object { +class ObjectTest_T2 extends SS_Object { protected $failover; protected $failoverArr = array(); @@ -541,7 +541,7 @@ class ObjectTest_T2 extends Object { } -class ObjectTest_MyObject extends Object { +class ObjectTest_MyObject extends SS_Object { public $title = 'my object'; /** @config */ private static $mystaticProperty = "MyObject"; @@ -555,7 +555,7 @@ class ObjectTest_MySubObject extends ObjectTest_MyObject { static $mystaticArray = array('two'); } -class ObjectTest_CreateTest extends Object { +class ObjectTest_CreateTest extends SS_Object { public $constructArguments; @@ -566,10 +566,10 @@ class ObjectTest_CreateTest extends Object { } -class ObjectTest_CreateTest2 extends Object {} -class ObjectTest_CreateTest3 extends Object {} +class ObjectTest_CreateTest2 extends SS_Object {} +class ObjectTest_CreateTest3 extends SS_Object {} -class ObjectTest_ExtensionTest extends Object { +class ObjectTest_ExtensionTest extends SS_Object { private static $extensions = array ( 'oBjEcTTEST_ExtendTest1', @@ -578,15 +578,15 @@ class ObjectTest_ExtensionTest extends Object { } -class ObjectTest_ExtensionTest2 extends Object { +class ObjectTest_ExtensionTest2 extends SS_Object { private static $extensions = array('ObjectTest_Extension'); } -class ObjectTest_ExtensionTest3 extends Object { +class ObjectTest_ExtensionTest3 extends SS_Object { } -class ObjectTest_ExtensionRemoveTest extends Object { +class ObjectTest_ExtensionRemoveTest extends SS_Object { private static $extensions = array ( 'ObjectTest_ExtendTest1', @@ -596,7 +596,7 @@ class ObjectTest_ExtensionRemoveTest extends Object { class ObjectTest_Extension extends Extension {} -class ObjectTest_CacheTest extends Object { +class ObjectTest_CacheTest extends SS_Object { public $count = 0; @@ -611,7 +611,7 @@ class ObjectTest_CacheTest extends Object { } -class ObjectTest_ExtendTest extends Object { +class ObjectTest_ExtendTest extends SS_Object { private static $extensions = array('ObjectTest_ExtendTest1', 'ObjectTest_ExtendTest2'); public function extendableMethod($argument = null) { return "ExtendTest($argument)"; } } @@ -635,7 +635,7 @@ class ObjectTest_ExtendTest4 extends ObjectTest_ExtendTest3 { public function extendableMethod($argument = null) { return "ExtendTest4($argument)"; } } -class ObjectTest_Extending extends Object implements TestOnly { +class ObjectTest_Extending extends SS_Object implements TestOnly { private static $extensions = array( 'ObjectTest_Extending_Extension' diff --git a/tests/i18n/_fakewebroot/i18nothermodule/code/i18nOtherModule.php b/tests/i18n/_fakewebroot/i18nothermodule/code/i18nOtherModule.php index 946073eeb..6d2902f8d 100644 --- a/tests/i18n/_fakewebroot/i18nothermodule/code/i18nOtherModule.php +++ b/tests/i18n/_fakewebroot/i18nothermodule/code/i18nOtherModule.php @@ -1,5 +1,5 @@ injector->convertServiceProperty($params); return parent::create($class, $params); } diff --git a/tests/model/ManyManyListExtensionTest.php b/tests/model/ManyManyListExtensionTest.php index 4b37e7848..9b12675ca 100644 --- a/tests/model/ManyManyListExtensionTest.php +++ b/tests/model/ManyManyListExtensionTest.php @@ -20,7 +20,7 @@ class ManyManyListExtensionTest extends SapphireTest { // This extends ManyManyListTest_Secondary with the secondary extension that adds the relationship back // to the primary. The instance from the fixture is ManyManyListTest_SecondarySub, deliberately a sub-class of // the extended class. - Object::add_extension('ManyManyListTest_Secondary', 'ManyManyListTest_IndirectSecondaryExtension'); + SS_Object::add_extension('ManyManyListTest_Secondary', 'ManyManyListTest_IndirectSecondaryExtension'); // Test from the primary (not extended) to the secondary (which is extended) $primary = $this->objFromFixture('ManyManyListTest_IndirectPrimary', 'manymany_extra_primary'); diff --git a/tests/security/MemberTest.php b/tests/security/MemberTest.php index 342a2da71..41790411e 100644 --- a/tests/security/MemberTest.php +++ b/tests/security/MemberTest.php @@ -487,7 +487,7 @@ class MemberTest extends FunctionalTest { * edit and delete their own record too. */ public function testCanManipulateOwnRecord() { - $extensions = $this->removeExtensions(Object::get_extensions('Member')); + $extensions = $this->removeExtensions(SS_Object::get_extensions('Member')); $member = $this->objFromFixture('Member', 'test'); $member2 = $this->objFromFixture('Member', 'staffmember'); @@ -515,7 +515,7 @@ class MemberTest extends FunctionalTest { } public function testAuthorisedMembersCanManipulateOthersRecords() { - $extensions = $this->removeExtensions(Object::get_extensions('Member')); + $extensions = $this->removeExtensions(SS_Object::get_extensions('Member')); $member = $this->objFromFixture('Member', 'test'); $member2 = $this->objFromFixture('Member', 'staffmember'); @@ -530,7 +530,7 @@ class MemberTest extends FunctionalTest { } public function testExtendedCan() { - $extensions = $this->removeExtensions(Object::get_extensions('Member')); + $extensions = $this->removeExtensions(SS_Object::get_extensions('Member')); $member = $this->objFromFixture('Member', 'test'); /* Normal behaviour is that you can't view a member unless canView() on an extension returns true */ diff --git a/thirdparty/Zend/Currency.php b/thirdparty/Zend/Currency.php index d3b51310a..1ecb735aa 100644 --- a/thirdparty/Zend/Currency.php +++ b/thirdparty/Zend/Currency.php @@ -850,7 +850,7 @@ class Zend_Currency if (!is_string($value) || (strpos($value, '0') === false)) { require_once 'Zend/Currency/Exception.php'; throw new Zend_Currency_Exception("'" . - ((gettype($value) === 'object') ? get_class($value) : $value) + ((gettype($value) === 'SS_Object') ? get_class($value) : $value) . "' is no format token"); } } diff --git a/thirdparty/Zend/Loader/Autoloader.php b/thirdparty/Zend/Loader/Autoloader.php index 360987787..432667cd5 100644 --- a/thirdparty/Zend/Loader/Autoloader.php +++ b/thirdparty/Zend/Loader/Autoloader.php @@ -371,7 +371,7 @@ class Zend_Loader_Autoloader /** * Add an autoloader to the beginning of the stack * - * @param object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation + * @param SS_Object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation * @param string|array $namespace Specific namespace(s) under which to register callback * @return Zend_Loader_Autoloader */ @@ -394,7 +394,7 @@ class Zend_Loader_Autoloader /** * Append an autoloader to the autoloader stack * - * @param object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation + * @param SS_Object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation * @param string|array $namespace Specific namespace(s) under which to register callback * @return Zend_Loader_Autoloader */ @@ -417,7 +417,7 @@ class Zend_Loader_Autoloader /** * Remove an autoloader from the autoloader stack * - * @param object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation + * @param SS_Object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation * @param null|string|array $namespace Specific namespace(s) from which to remove autoloader * @return Zend_Loader_Autoloader */ diff --git a/thirdparty/Zend/Loader/Autoloader/Resource.php b/thirdparty/Zend/Loader/Autoloader/Resource.php index 0a8ab6359..32e5c6f39 100644 --- a/thirdparty/Zend/Loader/Autoloader/Resource.php +++ b/thirdparty/Zend/Loader/Autoloader/Resource.php @@ -446,7 +446,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac * * @param string $resource * @param string $type - * @return object + * @return SS_Object * @throws Zend_Loader_Exception if resource type not specified or invalid */ public function load($resource, $type = null) diff --git a/thirdparty/Zend/Log.php b/thirdparty/Zend/Log.php index 4d3a72065..c7806728f 100644 --- a/thirdparty/Zend/Log.php +++ b/thirdparty/Zend/Log.php @@ -242,7 +242,7 @@ class Zend_Log * @param string $type 'writer' of 'filter' * @param mixed $config Zend_Config or Array * @param string $namespace - * @return object + * @return SS_Object * @throws Zend_Log_Exception */ protected function _constructFromConfig($type, $config, $namespace) diff --git a/thirdparty/simpletest/compatibility.php b/thirdparty/simpletest/compatibility.php index 31f31b7df..495981d27 100644 --- a/thirdparty/simpletest/compatibility.php +++ b/thirdparty/simpletest/compatibility.php @@ -14,8 +14,8 @@ class SimpleTestCompatibility { /** * Creates a copy whether in PHP5 or PHP4. - * @param object $object Thing to copy. - * @return object A copy. + * @param SS_Object $object Thing to copy. + * @return SS_Object A copy. * @access public * @static */ @@ -128,7 +128,7 @@ class SimpleTestCompatibility { /** * Test to see if an object is a member of a * class hiearchy. - * @param object $object Object to test. + * @param SS_Object $object Object to test. * @param string $class Root name of hiearchy. * @return boolean True if class in hiearchy. * @access public diff --git a/thirdparty/tinymce-spellchecker/classes/utils/JSON.php b/thirdparty/tinymce-spellchecker/classes/utils/JSON.php index d095258b7..d9306ac84 100644 --- a/thirdparty/tinymce-spellchecker/classes/utils/JSON.php +++ b/thirdparty/tinymce-spellchecker/classes/utils/JSON.php @@ -4,7 +4,7 @@ * * @package MCManager.utils * @author Moxiecode - * @copyright Copyright © 2007, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright � 2007, Moxiecode Systems AB, All rights reserved. */ define('JSON_BOOL', 1); @@ -474,7 +474,7 @@ class Moxiecode_JSON { case 'array': return $this->_encodeArray($input); - case 'object': + case 'SS_Object': return $this->_encodeArray(get_object_vars($input)); } diff --git a/view/ArrayData.php b/view/ArrayData.php index 9061a510b..3e431f1ea 100644 --- a/view/ArrayData.php +++ b/view/ArrayData.php @@ -21,7 +21,7 @@ class ArrayData extends ViewableData { protected $array; /** - * @param object|array $value An associative array, or an object with simple properties. + * @param SS_Object|array $value An associative array, or an object with simple properties. * Converts object properties to keys of an associative array. */ public function __construct($value) { diff --git a/view/SSViewer.php b/view/SSViewer.php index f88fa6468..a484bb8e9 100644 --- a/view/SSViewer.php +++ b/view/SSViewer.php @@ -131,7 +131,7 @@ class SSViewer_Scope { /** * Gets the current object and resets the scope. * - * @return object + * @return SS_Object */ public function self() { $result = $this->itemIterator ? $this->itemIterator->current() : $this->item; @@ -637,7 +637,7 @@ class SSViewer_DataPresenter extends SSViewer_Scope { if ($val) { $obj = $val['obj']; if ($name === 'hasValue') { - $res = $obj instanceof Object + $res = $obj instanceof SS_Object ? $obj->exists() : (bool)$obj; } else { @@ -1139,10 +1139,10 @@ class SSViewer implements Flushable { * Effectively this is the common code that both SSViewer#process and SSViewer_FromString#process call * * @param string $cacheFile - The path to the file that contains the template compiled to PHP - * @param Object $item - The item to use as the root scope for the template + * @param SS_Object $item - The item to use as the root scope for the template * @param array|null $overlay - Any variables to layer on top of the scope * @param array|null $underlay - Any variables to layer underneath the scope - * @param Object $inheritedScope - the current scope of a parent template including a sub-template + * @param SS_Object $inheritedScope - the current scope of a parent template including a sub-template * * @return string - The result of executing the template */ @@ -1179,7 +1179,7 @@ class SSViewer implements Flushable { * * @param ViewableData $item * @param array|null $arguments - arguments to an included template - * @param Object $inheritedScope - the current scope of a parent template including a sub-template + * @param SS_Object $inheritedScope - the current scope of a parent template including a sub-template * * @return HTMLText Parsed template output. */ diff --git a/view/ViewableData.php b/view/ViewableData.php index ce1d35e92..cda41e5dc 100644 --- a/view/ViewableData.php +++ b/view/ViewableData.php @@ -9,7 +9,7 @@ * @package framework * @subpackage view */ -class ViewableData extends Object implements IteratorAggregate { +class ViewableData extends SS_Object implements IteratorAggregate { /** * An array of objects to cast certain fields to. This is set up as an array in the format: @@ -473,7 +473,7 @@ class ViewableData extends Object implements IteratorAggregate { $castConstructor = $this->config()->default_cast; } - $valueObject = Object::create_from_string($castConstructor, $fieldName); + $valueObject = SS_Object::create_from_string($castConstructor, $fieldName); $valueObject->setValue($value, $this); $value = $valueObject; @@ -516,7 +516,7 @@ class ViewableData extends Object implements IteratorAggregate { public function hasValue($field, $arguments = null, $cache = true) { $result = $cache ? $this->cachedCall($field, $arguments) : $this->obj($field, $arguments, false, false); - if(is_object($result) && $result instanceof Object) { + if(is_object($result) && $result instanceof SS_Object) { return $result->exists(); } else { // Empty paragraph checks are a workaround for TinyMCE @@ -537,7 +537,7 @@ class ViewableData extends Object implements IteratorAggregate { */ public function XML_val($field, $arguments = null, $cache = false) { $result = $this->obj($field, $arguments, false, $cache); - return (is_object($result) && $result instanceof Object) ? $result->forTemplate() : $result; + return (is_object($result) && $result instanceof SS_Object) ? $result->forTemplate() : $result; } /** From e23fcda6b60f63d67948c5854ce0d2a05f4258e7 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Thu, 30 Nov 2017 18:11:59 +0000 Subject: [PATCH 2/3] Remove usage of asserts with strings --- core/Diff.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/Diff.php b/core/Diff.php index cab862dc3..2263705d3 100644 --- a/core/Diff.php +++ b/core/Diff.php @@ -413,7 +413,7 @@ class _DiffEngine $i = 0; $j = 0; - USE_ASSERTS && assert('sizeof($lines) == sizeof($changed)'); + USE_ASSERTS && assert(sizeof($lines) == sizeof($changed)); $len = sizeof($lines); $other_len = sizeof($other_changed); @@ -433,7 +433,7 @@ class _DiffEngine $j++; while ($i < $len && ! $changed[$i]) { - USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]'); + USE_ASSERTS && assert($j < $other_len && ! $other_changed[$j]); $i++; $j++; while ($j < $other_len && $other_changed[$j]) $j++; @@ -465,10 +465,10 @@ class _DiffEngine $changed[--$i] = false; while ($start > 0 && $changed[$start - 1]) $start--; - USE_ASSERTS && assert('$j > 0'); + USE_ASSERTS && assert($j > 0); while ($other_changed[--$j]) continue; - USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]'); + USE_ASSERTS && assert($j >= 0 && !$other_changed[$j]); } /* @@ -491,7 +491,7 @@ class _DiffEngine while ($i < $len && $changed[$i]) $i++; - USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]'); + USE_ASSERTS && assert($j < $other_len && ! $other_changed[$j]); $j++; if ($j < $other_len && $other_changed[$j]) { $corresponding = $i; @@ -508,10 +508,10 @@ class _DiffEngine while ($corresponding < $i) { $changed[--$start] = 1; $changed[--$i] = 0; - USE_ASSERTS && assert('$j > 0'); + USE_ASSERTS && assert($j > 0); while ($other_changed[--$j]) continue; - USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]'); + USE_ASSERTS && assert($j >= 0 && !$other_changed[$j]); } } } From 74a3ba54ae3f02158ba81622bd9933ae3e98c665 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Fri, 1 Dec 2017 10:41:30 +0000 Subject: [PATCH 3/3] FIX count size of $relations --- model/DataObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/DataObject.php b/model/DataObject.php index 0652a1854..ac546195b 100644 --- a/model/DataObject.php +++ b/model/DataObject.php @@ -890,7 +890,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity $parentObj = $relObj; $relObj = $relObj->$relation(); // If the intermediate relationship objects have been created, then write them - if($iID || (!$relObj->ID && $parentObj != $this)) { + if($iID || (!$relObj->ID && $parentObj != $this)) { $relObj->write(); $relatedFieldName = $relation."ID"; $parentObj->$relatedFieldName = $relObj->ID;