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.1] Fix PHP warnings on newly created custom fields #42956

Merged
merged 2 commits into from
May 11, 2024

Conversation

Quy
Copy link
Contributor

@Quy Quy commented Mar 4, 2024

Pull Request for Issue #40681 .

Summary of Changes

Separate conditions of the if statement to apply to new fields vs existing fields accordingly.

When creating a new field and the Search Index setting is Don't make searchable, the last 2 conditions are not applicable thus php warnings.

PHP Warning:  Attempt to read property "params" on null in \administrator\components\com_fields\src\Model\FieldModel.php on line 123
PHP Warning:  Trying to access array offset on value of type null in \administrator\components\com_fields\src\Model\FieldModel.php on line 123

Testing Instructions

Install Blog Sample Data.
No errors in PHP log.

Add a new custom field.
Save field.
No errors in PHP log.

@laoneo
Copy link
Member

laoneo commented Mar 7, 2024

Three times nested if conditions do look for me as not the right fix. Probably adding some comments to the existing one would be a better solution.

@Quy
Copy link
Contributor Author

Quy commented Mar 9, 2024

@Hackwar Please review as it originated with #38650. Thanks.

@exlemor
Copy link

exlemor commented Apr 11, 2024

I have tested this item ✅ successfully on 51b02c0

I was able to test this successfully - tested every field type - no error log entries.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42956.

@cybersalt
Copy link

Try as I may, I could not get these errors even before the patch.

@viocassel
Copy link
Contributor

I have tested this item ✅ successfully on 51b02c0


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42956.

@Quy
Copy link
Contributor Author

Quy commented Apr 15, 2024

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42956.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Apr 15, 2024
@bembelimen bembelimen merged commit 8e1106d into joomla:5.1-dev May 11, 2024
4 checks passed
@bembelimen
Copy link
Contributor

Thx

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label May 11, 2024
@bembelimen bembelimen added this to the Joomla! 5.1.1 milestone May 11, 2024
@Quy Quy deleted the 40681-fields branch May 11, 2024 20:06
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

8 participants