[5.0] Fix PHP warnings e.g. when installing Blog Sample Data #40681
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 #40680 .
Summary of Changes
This pull request (PR) fixes the PHP warnings reported in the linked issue when installing Blog Sample Data by adding an
isset
check.In addition it fixes
PHP Warning: Undefined array key "searchindex" in /administrator/components/com_fields/src/Model/FieldModel.php on line 886
happening when publishing or unpublishing a field which doesn't have the "searchindex" parameter set, e.g. when having updated from 4.4 and not saved the field again, or when having installed Blog Sample Data without that parameter.This is one possible way to fix the issue, but it might be not the best way.
@Hackwar Please check. I have tested and it works, but as said, it might be the wrong way to fix it. But keep in mind that when updating from 4.4 and not having a migration for the fields parameters, we always might run into the new parameter not being set.
Testing Instructions
On a clean, current 5.0-dev branch where PR #38650 has been merged, make a new installation.
Then login to backend.
Then either set error reporting to maximum or make sure that PHP warnings are logged into a log file.
Actual result BEFORE applying this Pull Request
PHP warnings:
When error reporting is set to maximum, the Blog Sampe Data installation fails.
Expected result AFTER applying this Pull Request
No PHP warnings, installation of Blog Sample Data succeeds in any case.
Link to documentations
Please select:
No documentation changes for docs.joomla.org needed
No documentation changes for manual.joomla.org needed