Removed and backward incompatibility
Developer Note
Since this version of Joomla has not been released yet, this page can change anytime.
All the deprecated features than have now been removed and any backward incompatibilities. There should be an explanation of how to mitigate the removals / changes.
CMS Input object switched to Framework Input object
- PR's:
- Description: The CMS Input namespace
\Joomla\CMS\Input
has been removed. The CMS core code has switched the code to the Framework Input library with the namespace\Joomla\Input
, which is very much a drop-in replacement. This is especially of relevance if you are using the MVC classes, which now use the framework class. Make sure that your code imports the correct class.
CMS BaseApplication and CLI classes have been removed
- PR: https://github.com/joomla/joomla-cms/pull/42884
- Description: The class
\Joomla\CMS\Application\BaseApplication
and\Joomla\CMS\Application\CliApplication
respective CLI input classes have been removed. The CMS core code has been switched to use the Application package of the Joomla Framework. Any reference to these classes should be replaced with the namespace\Joomla\Application
. Cli apps should be replaced by console plugins.
UTC is used instead of GMT
- PR: https://github.com/joomla/joomla-cms/pull/43912
- Description: To unify the code base, all instances do use or fallback to UTC timezone. Make sure that your code doesn't do a check against GMT string.
Removed legacy b/c code in \Joomla\CMS\Date\Date Class
- PR: https://github.com/joomla/joomla-cms/pull/43959
- Description: Removed Date::$gmt and Date::$stz variables and related code. If you extend the \Joomla\CMS\Date\Date class make sure not to depend on them any longer.
View classes do not have a database reference
- PR: https://github.com/joomla/joomla-cms/pull/42962
- Description: In Joomla 3 some views had a reference to the global database instance to check if a date is a special null date (0000-00-00 00:00:00). Since Joomla 4 all these dates are real null values and the database check is not used anymore. If there are some old template overrides in place with these checks, they can be removed.
// Old:
if ($this->item->created !== $this->db->getNullDate()) {
echo $this->item->created;
}
// New:
if ($this->item->created !== null) {
echo $this->item->created;
}
getItem returns a stdClass instead of CMSObject
- PR: https://github.com/joomla/joomla-cms/pull/42961
- File: libraries/src/MVC/Model/AdminModel.php
- Description: The
AdminModel
class does return astdClass
object in thegetItem
function instead of aCMSObject
. This means that all the deprecated functions ofCMSObject
are not available anymore. Mainly the set and get function should be replaced accordingly as documented in theCMSObject
class or the respective traits. For example you can use
// Old:
$article = $app->bootComponent('content')->getMVCFactory()->createModel('Article', 'Administrator')->getItem(1);
echo $article->get('title');
// New:
$article = $app->bootComponent('content')->getMVCFactory()->createModel('Article', 'Administrator')->getItem(1);
echo $article->title;
None namespaced indexer file removed
- PR: https://github.com/joomla/joomla-cms/pull/44646
- Folder: administrator/components/com_finder/helpers/indexer
- Description: The files in /administrator/components/com_finder/helpers/indexer were containing the none namespaced classes and are left only for legacy include code. They are empty as class alias do exist for them already. The include code in extensions can be removed and the namespaced classes should be used as they are autoloaded. For example you can use
// Old:
require_once JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/helper.php';
FinderIndexerHelper::getFinderPluginId();
// New:
Joomla\Component\Finder\Administrator\Helper\FinderHelper::getFinderPluginId();
App variable is removed in plugins
- PR: https://github.com/joomla/joomla-cms/pull/44647
- Folder: plugins
- Description: The
$app
variable is left in some plugins for layout overrides of the plugins/tmpl folder and is not used anymore in the plugin class itself and the respective layouts. ThegetApplication
function should be used instead
// Old:
$app = $this->app;
// New:
$app = $this->getApplication();
JCOMPAT_UNICODE_PROPERTIES constant got removed in FormRule class
- PR: https://github.com/joomla/joomla-cms/pull/44662
- File: libraries/src/Form/FormRule.php
- Description: The
FormRule
class has a deprecatedJCOMPAT_UNICODE_PROPERTIES
constant which is not used anymore and got removed without a replacement. If the constant is still be used in an extension, copy the code from the FormRule class to your extension.
createThumbs function got removed from the image class
- PR: https://github.com/joomla/joomla-cms/pull/44663
- File: libraries/src/Image/Image.php
- Description: The
createThumbs
function in theImage
class got removed as the functioncreateThumbnails
should be used instead. For example you can use
// Old:
$image = new Image($path);
$image->createThumbs('50x50');
// New:
$image = new Image($path);
$image->createThumbnails('50x50');
Client id attribute removed in form models cleanCache function
- PR: https://github.com/joomla/joomla-cms/pull/44637
- Description: The
cleanCache
function doesn't use the$clientId
attribute anymore since 4.0. This pr removes the leftovers in various models which do extend theBaseDatabaseModel
cleanCache
function. If you extend one of these models and do overwrite thecleanCache
function, remove the$clientId
attribute.
Removed isCli function in application classes
- PR: https://github.com/joomla/joomla-cms/pull/44611
- Files: libraries/src/Application/CMSApplicationInterface.php
- Description: The deprecated
isCli
got removed from the application classes. It was introduced as transient flag which was deprecated right from the beginning and should never be used anyway. If an extension was still using it, then adapt the code as described below
// Old:
if ($app->isCli()) {
// Do your stuff
}
// New:
if ($app instanceof \Joomla\CMS\Application\ConsoleApplication) {
// Do your stuff
}