[7.0] Add a compatibility switch for deprecated functions#47911
Conversation
|
From PHP manual: Passing E_USER_ERROR as the error_level is now deprecated. Throw an Exception or call exit() instead. Maybe throw |
|
I had exceptions first, but then you copy basically the same text as in trigger_error. Till we have a decision if this is an acceptable way to transition from widely used deprecated code I leave it as it is. But I was not aware that the constant was deprecated, definitely worth then to switch to exception. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
@laoneo As this has been fixed meanwhile, please remove that sentence from the PR description. |
|
thanks |
Summary of Changes
Deprecated classes, assets and classnames can be moved to the compatibility plugin, but not single deprecated functions. In core we have a lot of deprecated functions which are widely used in the past in template overrides or other custom PHP code. Removing them would be a hard backwards compatibility break. This pr introduces a switch for deprecated functions, enabled in the compatibility plugin. This is a fallback for sites with old code or unmaintained extensions to give them an extra two years to update that code.
Testing Instructions
Add the following code to the file /components/com_content/src/Dispatcher/Dispatcher.php after line 36:
\Joomla\CMS\Factory::getConfig();Load the site home page with the compatibility 7 plugin enabled and disabled.
Actual result BEFORE applying this Pull Request
It works with the plugin enabled and disabled.
Expected result AFTER applying this Pull Request
It shows an error when the plugin is disabled and loads fine when enabled.
Link to documentations
Please select:
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org: Add a compatibility switch for deprecated functions Manual#671
No documentation changes for manual.joomla.org needed