-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.3] Fix template manager errors on PHP 8.1 and later when having empty parameters #40544
Merged
obuisard
merged 6 commits into
joomla:4.3-dev
from
richard67:4.3-dev-fix-template-manager-for-empty-parameters
May 7, 2023
Merged
[4.3] Fix template manager errors on PHP 8.1 and later when having empty parameters #40544
obuisard
merged 6 commits into
joomla:4.3-dev
from
richard67:4.3-dev-fix-template-manager-for-empty-parameters
May 7, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fix PHP error "Deprecated explode(): Passing null to parameter 2 ($string) of type string is deprecated" in template manager
2 tasks
richard67
changed the title
[4.3] [WiP] Fix template manager errors on PHP 8.1 and later when having empty parameters
[4.3] Fix template manager errors on PHP 8.1 and later when having empty parameters
May 5, 2023
This reverts commit c0570f5.
I have tested this item ✅ successfully on 70e69da This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40544. |
I have tested this item ✅ successfully on 70e69da This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40544. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40544. |
Thank you Richard @richard67 for the PR! |
Thanks all. |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request for Issue # .
Summary of Changes
When using PHP 8.1 or later and the
params
value ofcom_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.
Testing Instructions
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:You can also test with an empty string:
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 .
Actual result BEFORE applying this Pull Request
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.
Expected result AFTER applying this Pull Request
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.
Link to documentations
Please select:
No documentation changes for docs.joomla.org needed
No documentation changes for manual.joomla.org needed