29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-08-03 17:50:26 +00:00

Fix for TypeError: count() in webservices when running PHP 8.x (#40610)

This commit is contained in:
Martin Carl Kopp 2023-07-20 16:05:07 +02:00 committed by GitHub
parent 63e43cf7ed
commit e8c9cf8ab2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -240,29 +240,30 @@ class GroupModel extends AdminModel
$parts = FieldsHelper::extract($this->state->get('filter.context'));
// If we don't have a valid context then return early
if (!$parts) {
return;
}
// Extract the component name
$component = $parts[0];
// Extract the optional section name
$section = (count($parts) > 1) ? $parts[1] : null;
// Extract the section name
$section = $parts[1];
if ($parts) {
// Set the access control rules field component value.
$form->setFieldAttribute('rules', 'component', $component);
}
// Set the access control rules field component value.
$form->setFieldAttribute('rules', 'component', $component);
if ($section !== null) {
// Looking first in the component models/forms folder
$path = Path::clean(JPATH_ADMINISTRATOR . '/components/' . $component . '/models/forms/fieldgroup/' . $section . '.xml');
// Looking first in the component models/forms folder
$path = Path::clean(JPATH_ADMINISTRATOR . '/components/' . $component . '/models/forms/fieldgroup/' . $section . '.xml');
if (file_exists($path)) {
$lang = Factory::getLanguage();
$lang->load($component, JPATH_BASE);
$lang->load($component, JPATH_BASE . '/components/' . $component);
if (file_exists($path)) {
$lang = Factory::getLanguage();
$lang->load($component, JPATH_BASE);
$lang->load($component, JPATH_BASE . '/components/' . $component);
if (!$form->loadFile($path, false)) {
throw new \Exception(Text::_('JERROR_LOADFILE_FAILED'));
}
if (!$form->loadFile($path, false)) {
throw new \Exception(Text::_('JERROR_LOADFILE_FAILED'));
}
}
}