PHP 7.2 compatibility

This commit is contained in:
Loz Calver 2019-01-02 11:08:48 +00:00
parent c0fbe98851
commit 1fc11a7854
3 changed files with 6 additions and 2 deletions

View File

@ -8,6 +8,10 @@ if (!file_exists(BASE_PATH . DIRECTORY_SEPARATOR . DMS_DIR)) {
user_error('DMS directory named incorrectly. Please install the DMS module into a folder named: ' . DMS_DIR);
}
// Ensure compatibility with PHP 7.2 ("object" is a reserved word),
// with SilverStripe 3.6 (using Object) and SilverStripe 3.7 (using SS_Object)
if (!class_exists('SS_Object')) class_alias('Object', 'SS_Object');
CMSMenu::remove_menu_item('DMSDocumentAddController');
ShortcodeParser::get('default')->register(

View File

@ -1,5 +1,5 @@
<?php
class DMS extends Object implements DMSInterface
class DMS extends SS_Object implements DMSInterface
{
/**
* Folder to store the documents in

View File

@ -132,7 +132,7 @@ class DMSUploadField extends UploadField
// Search for relations that can hold the uploaded files.
if ($relationClass = $this->getRelationAutosetClass()) {
// Create new object explicitly. Otherwise rely on Upload::load to choose the class.
$fileObject = Object::create($relationClass);
$fileObject = SS_Object::create($relationClass);
}
}