Skip to content
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

[5.0] Fix PHP warnings e.g. when installing Blog Sample Data #40681

Merged

Conversation

richard67
Copy link
Member

@richard67 richard67 commented May 29, 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

@HLeithner HLeithner merged commit b509946 into joomla:5.0-dev May 29, 2023
@HLeithner
Copy link
Member

thanks

@HLeithner HLeithner added this to the Joomla! 5.0 milestone May 29, 2023
@richard67 richard67 deleted the 5.0-dev-fix-field-model-php-warnings branch May 29, 2023 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants