User tests: Successful: Unsuccessful:
Pull Request for Issue # .
When using PHP 8.1 or later and the params
value of com_templates
is empty in the #__extensions
table in database, you get a bunch of PHP errors "Deprecated explode(): Passing null to parameter 2 ($string) of type string is deprecated" in the template manager in backend, and the template manager can not be used, at least that’s the case when error reporting is set to Maximum in global configuration.
The reason is that there are several calls like explode(',', $params->get('image_formats')
in the template manager code.
The parameters for which that happens are all of the type "comma-separated list of allowed file name extensions".
This PR here fixes that by using the same default value for each of these parameters which we use for new installation for that parameters.
It's worth a discussion if we should have these default values because it should also be possible to define an empty value for such a list of allowed file name extensions, which currently is not the case due to the default values specified for the fields in the configuration XML. But that should be fixed with a different PR if that's desired.
It might need to set error reporting to maximum in global configuration to get the issue.
params
value to an empty JSON in database, e.g. with phpMyAdmin:UPDATE `#__extensions` SET `params` = '{}' WHERE `name` = 'com_templates';
You can also test with an empty string:
UPDATE `#__extensions` SET `params` = '' WHERE `name` = 'com_templates';
Go to the template manager.
Result: See section "Actual result BEFORE applying this Pull Request" below.
Apply the patch and go again to the template manager or reload the page if still there.
Result: See section "Expected result AFTER applying this Pull Request" below.
Code review: Verify that the default values used in this PR here are the same as in the configuration XML https://github.com/joomla/joomla-cms/blob/4.3-dev/administrator/components/com_templates/config.xml and the installation SQL https://github.com/joomla/joomla-cms/blob/4.3-dev/installation/sql/mysql/base.sql#L174 .
A bunch of PHP errors "Deprecated explode(): Passing null to parameter 2 ($string) of type string is deprecated" in the template manager.
The template manager can not be used, and some quickicon checks in the system panel fail because the overrides check fails.
No PHP errors "Deprecated explode(): Passing null to parameter 2 ($string) of type string is deprecated" in the template manager.
The template manager and the quickicon checks in the system panel are working.
Please select:
No documentation changes for docs.joomla.org needed
No documentation changes for manual.joomla.org needed
Category | ⇒ | Administration com_templates |
Status | New | ⇒ | Pending |
Title |
|
Labels |
Added:
PHP 8.x
bug
PR-4.3-dev
|
I have tested this item
Works as expected
Status | Pending | ⇒ | Ready to Commit |
RTC
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-05-07 20:11:18 |
Closed_By | ⇒ | obuisard |
Thank you Richard @richard67 for the PR!
Thanks all.
I have tested this item✅ successfully on 70e69da
After applying the Patch, error is fixed.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40544.