Installing Blog Sample Data fails on 5.0-dev after PR #38650 has been merged when error reporting is set to Maximum and PHP 8.1+ is used.
When error reporting is not set to Maximum, the installation succeeds.
But in both cases you get the PHP warnings mentioned below.
See also #38650 (comment) .
No PHP warnings, installation of Blog Sample Data succeeds in any case.
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
Current 5.0-dev branch with PR #38650 merged.
PHP 8.1
It needs to add isset
checks to the if
conditions, i.e. change the code here
https://github.com/joomla/joomla-cms/blob/5.0-dev/administrator/components/com_fields/src/Model/FieldModel.php#L118-L124
from
if (
(is_null($field) && $data['params']['searchindex'] > 0)
|| ($field->params['searchindex'] != $data['params']['searchindex'])
|| ($data['params']['searchindex'] > 0 && ($field->state != $data['state'] || $field->access != $data['access']))
) {
Factory::getApplication()->enqueueMessage(Text::_('COM_FIELDS_SEARCHINDEX_MIGHT_REQUIRE_REINDEXING'), 'notice');
}
to
if (isset($data['params']['searchindex'])
&& ((is_null($field) && $data['params']['searchindex'] > 0)
|| ($field->params['searchindex'] != $data['params']['searchindex'])
|| ($data['params']['searchindex'] > 0 && ($field->state != $data['state'] || $field->access != $data['access'])))
) {
Factory::getApplication()->enqueueMessage(Text::_('COM_FIELDS_SEARCHINDEX_MIGHT_REQUIRE_REINDEXING'), 'notice');
}
But maybe that's not right, and the right fix would be to add the new parameter searchindex
to the fields creating in the blog sample data plugin.
Labels |
Added:
No Code Attached Yet
|
Labels |
Added:
PHP 8.x
|
Labels |
Removed:
PHP 8.x
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-05-29 14:34:36 |
Closed_By | ⇒ | richard67 |
I've created a PR to fix the issue as suggested in the "Additional comments" section of the description of this issue here.
If the PR turns out to be wrong I'll reopen this issue.