PR-5.0-dev Pending

User tests: Successful: Unsuccessful:

avatar richard67
richard67
29 May 2023

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:

PHP Warning:  Undefined array key "searchindex" in /administrator/components/com_fields/src/Model/FieldModel.php on line 119
PHP Warning:  Attempt to read property "params" on null in /administrator/components/com_fields/src/Model/FieldModel.php on line 120
PHP Warning:  Trying to access array offset on value of type null in /administrator/components/com_fields/src/Model/FieldModel.php on line 120
PHP Warning:  Undefined array key "searchindex" in/administrator/components/com_fields/src/Model/FieldModel.php on line 120
PHP Warning:  Undefined array key "searchindex" in /administrator/components/com_fields/src/Model/FieldModel.php on line 121

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

avatar joomla-cms-bot joomla-cms-bot - change - 29 May 2023
Category Administration com_fields
avatar richard67 richard67 - open - 29 May 2023
avatar richard67 richard67 - change - 29 May 2023
Status New Pending
daa1774 29 May 2023 avatar richard67 PHPCS
avatar richard67 richard67 - change - 29 May 2023
Labels Added: PR-5.0-dev
avatar richard67 richard67 - change - 29 May 2023
The description was changed
avatar richard67 richard67 - edited - 29 May 2023
avatar richard67 richard67 - change - 29 May 2023
The description was changed
avatar richard67 richard67 - edited - 29 May 2023
avatar richard67 richard67 - change - 29 May 2023
The description was changed
avatar richard67 richard67 - edited - 29 May 2023
avatar HLeithner HLeithner - change - 29 May 2023
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-05-29 17:31:09
Closed_By HLeithner
avatar HLeithner HLeithner - close - 29 May 2023
avatar HLeithner HLeithner - merge - 29 May 2023
avatar HLeithner
HLeithner - comment - 29 May 2023

thanks

Add a Comment

Login with GitHub to post a comment