Commit bd2ced46 authored by Thomas Pronold's avatar Thomas Pronold Committed by Benni Mack
Browse files

[TASK] Get rid of "PHP Notice: Undefined index" notices

Running a clean installation minimal setup throws
a lot of "PHP Notice: Undefined index: " notices.
This commit removes the ones from the frontend.

Resolves: #91116
Releases: master, 10.4
Change-Id: I1f81150ed48ae170682d68d1169c1de2963e0021
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64238

Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 9c9046a5
...@@ -64,6 +64,6 @@ $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['adminPanel_save'] ...@@ -64,6 +64,6 @@ $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['adminPanel_save']
// The admin panel has a module to show log messages. Register a debug logger to gather those. // The admin panel has a module to show log messages. Register a debug logger to gather those.
$GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'][\TYPO3\CMS\Core\Log\LogLevel::DEBUG][\TYPO3\CMS\Adminpanel\Log\InMemoryLogWriter::class] = []; $GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'][\TYPO3\CMS\Core\Log\LogLevel::DEBUG][\TYPO3\CMS\Adminpanel\Log\InMemoryLogWriter::class] = [];
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['adminpanel_requestcache'])) { if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['adminpanel_requestcache'] ?? null)) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['adminpanel_requestcache'] = []; $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['adminpanel_requestcache'] = [];
} }
...@@ -246,7 +246,7 @@ class BackendModuleRepository implements SingletonInterface ...@@ -246,7 +246,7 @@ class BackendModuleRepository implements SingletonInterface
$dummyScript = (string)$uriBuilder->buildUriFromRoute('dummy'); $dummyScript = (string)$uriBuilder->buildUriFromRoute('dummy');
foreach ($loadedModules as $moduleName => $moduleData) { foreach ($loadedModules as $moduleName => $moduleData) {
$moduleLink = ''; $moduleLink = '';
if (!is_array($moduleData['sub'])) { if (!is_array($moduleData['sub'] ?? null)) {
$moduleLink = $moduleData['script']; $moduleLink = $moduleData['script'];
} }
$moduleLink = GeneralUtility::resolveBackPath($moduleLink); $moduleLink = GeneralUtility::resolveBackPath($moduleLink);
...@@ -259,7 +259,7 @@ class BackendModuleRepository implements SingletonInterface ...@@ -259,7 +259,7 @@ class BackendModuleRepository implements SingletonInterface
'icon' => $this->getModuleIcon($moduleKey, $moduleData), 'icon' => $this->getModuleIcon($moduleKey, $moduleData),
'link' => $moduleLink, 'link' => $moduleLink,
'description' => $moduleLabels['shortdescription'], 'description' => $moduleLabels['shortdescription'],
'standalone' => (bool)$moduleData['standalone'] 'standalone' => (bool)($moduleData['standalone'] ?? false)
]; ];
if ((($moduleData['standalone'] ?? false) === false) && !is_array($moduleData['sub']) && $moduleData['script'] !== $dummyScript) { if ((($moduleData['standalone'] ?? false) === false) && !is_array($moduleData['sub']) && $moduleData['script'] !== $dummyScript) {
// Work around for modules with own main entry, but being self the only submodule // Work around for modules with own main entry, but being self the only submodule
...@@ -275,7 +275,7 @@ class BackendModuleRepository implements SingletonInterface ...@@ -275,7 +275,7 @@ class BackendModuleRepository implements SingletonInterface
'navigationFrameScriptParam' => null, 'navigationFrameScriptParam' => null,
'navigationComponentId' => null 'navigationComponentId' => null
]; ];
} elseif (is_array($moduleData['sub'])) { } elseif (is_array($moduleData['sub'] ?? null)) {
foreach ($moduleData['sub'] as $submoduleName => $submoduleData) { foreach ($moduleData['sub'] as $submoduleName => $submoduleData) {
if (isset($submoduleData['script'])) { if (isset($submoduleData['script'])) {
$submoduleLink = GeneralUtility::resolveBackPath($submoduleData['script']); $submoduleLink = GeneralUtility::resolveBackPath($submoduleData['script']);
...@@ -286,7 +286,7 @@ class BackendModuleRepository implements SingletonInterface ...@@ -286,7 +286,7 @@ class BackendModuleRepository implements SingletonInterface
$submoduleLabels = $moduleLoader->getLabelsForModule($submoduleKey); $submoduleLabels = $moduleLoader->getLabelsForModule($submoduleKey);
$submoduleDescription = $submoduleLabels['shortdescription']; $submoduleDescription = $submoduleLabels['shortdescription'];
$originalLink = $submoduleLink; $originalLink = $submoduleLink;
$navigationFrameScript = $submoduleData['navFrameScript']; $navigationFrameScript = $submoduleData['navFrameScript'] ?? null;
$modules[$moduleKey]['subitems'][$submoduleKey] = [ $modules[$moduleKey]['subitems'][$submoduleKey] = [
'name' => $moduleName . '_' . $submoduleName, 'name' => $moduleName . '_' . $submoduleName,
'title' => $submoduleLabels['title'], 'title' => $submoduleLabels['title'],
...@@ -296,12 +296,12 @@ class BackendModuleRepository implements SingletonInterface ...@@ -296,12 +296,12 @@ class BackendModuleRepository implements SingletonInterface
'originalLink' => $originalLink, 'originalLink' => $originalLink,
'description' => $submoduleDescription, 'description' => $submoduleDescription,
'navigationFrameScript' => $navigationFrameScript, 'navigationFrameScript' => $navigationFrameScript,
'navigationFrameScriptParam' => $submoduleData['navFrameScriptParam'], 'navigationFrameScriptParam' => $submoduleData['navFrameScriptParam'] ?? null,
'navigationComponentId' => $submoduleData['navigationComponentId'] 'navigationComponentId' => $submoduleData['navigationComponentId'] ?? null
]; ];
// if the main module has a navframe script, inherit to the submodule, // if the main module has a navframe script, inherit to the submodule,
// but only if it is not disabled explicitly (option is set to FALSE) // but only if it is not disabled explicitly (option is set to FALSE)
if ($moduleData['navFrameScript'] && $submoduleData['inheritNavigationComponentFromMainModule'] !== false) { if (($moduleData['navFrameScript'] ?? false) && $submoduleData['inheritNavigationComponentFromMainModule'] !== false) {
$modules[$moduleKey]['subitems'][$submoduleKey]['parentNavigationFrameScript'] = $moduleData['navFrameScript']; $modules[$moduleKey]['subitems'][$submoduleKey]['parentNavigationFrameScript'] = $moduleData['navFrameScript'];
} }
} }
......
...@@ -584,7 +584,7 @@ class ModuleTemplate ...@@ -584,7 +584,7 @@ class ModuleTemplate
$getParams = GeneralUtility::_GET(); $getParams = GeneralUtility::_GET();
$storeArray = array_merge( $storeArray = array_merge(
GeneralUtility::compileSelectedGetVarsFromArray($gvList, $getParams), GeneralUtility::compileSelectedGetVarsFromArray($gvList, $getParams),
['SET' => GeneralUtility::compileSelectedGetVarsFromArray($setList, (array)$GLOBALS['SOBE']->MOD_SETTINGS)] ['SET' => GeneralUtility::compileSelectedGetVarsFromArray($setList, (array)($GLOBALS['SOBE']->MOD_SETTINGS ?? []))]
); );
return HttpUtility::buildQueryString($storeArray, '&'); return HttpUtility::buildQueryString($storeArray, '&');
} }
......
...@@ -3580,9 +3580,9 @@ class BackendUtility ...@@ -3580,9 +3580,9 @@ class BackendUtility
{ {
$simUser = ''; $simUser = '';
$simTime = ''; $simTime = '';
if ($pageInfo['fe_group'] > 0) { if (($pageInfo['fe_group'] ?? 0) > 0) {
$simUser = '&ADMCMD_simUser=' . $pageInfo['fe_group']; $simUser = '&ADMCMD_simUser=' . $pageInfo['fe_group'];
} elseif ((int)$pageInfo['fe_group'] === -2) { } elseif ((int)($pageInfo['fe_group'] ?? 0) === -2) {
// -2 means "show at any login". We simulate first available fe_group. // -2 means "show at any login". We simulate first available fe_group.
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('fe_groups'); ->getQueryBuilderForTable('fe_groups');
...@@ -3600,8 +3600,8 @@ class BackendUtility ...@@ -3600,8 +3600,8 @@ class BackendUtility
$simUser = '&ADMCMD_simUser=' . $activeFeGroupRow['uid']; $simUser = '&ADMCMD_simUser=' . $activeFeGroupRow['uid'];
} }
} }
$startTime = (int)$pageInfo['starttime']; $startTime = (int)($pageInfo['starttime'] ?? 0);
$endTime = (int)$pageInfo['endtime']; $endTime = (int)($pageInfo['endtime'] ?? 0);
if ($startTime > $GLOBALS['EXEC_TIME']) { if ($startTime > $GLOBALS['EXEC_TIME']) {
// simulate access time to ensure PageRepository will find the page and in turn PageRouter will generate // simulate access time to ensure PageRepository will find the page and in turn PageRouter will generate
// an URL for it // an URL for it
......
...@@ -1221,7 +1221,7 @@ class BackendUserAuthentication extends AbstractUserAuthentication ...@@ -1221,7 +1221,7 @@ class BackendUserAuthentication extends AbstractUserAuthentication
// Enabled Backend Modules // Enabled Backend Modules
$this->groupData['modules'] = $this->user['userMods']; $this->groupData['modules'] = $this->user['userMods'];
// Add available widgets // Add available widgets
$this->groupData['available_widgets'] = $this->user['available_widgets']; $this->groupData['available_widgets'] = $this->user['available_widgets'] ?? '';
// Add Allowed Languages // Add Allowed Languages
$this->groupData['allowed_languages'] = $this->user['allowed_languages']; $this->groupData['allowed_languages'] = $this->user['allowed_languages'];
// Set user value for workspace permissions. // Set user value for workspace permissions.
......
...@@ -295,7 +295,7 @@ abstract class AbstractMetaTagManager implements MetaTagManagerInterface ...@@ -295,7 +295,7 @@ abstract class AbstractMetaTagManager implements MetaTagManagerInterface
} }
foreach ($this->handledProperties as $handledProperty => $handledPropertyConfig) { foreach ($this->handledProperties as $handledProperty => $handledPropertyConfig) {
foreach ((array)$handledPropertyConfig['allowedSubProperties'] as $allowedSubProperty => $allowedSubPropertyConfig) { foreach ((array)($handledPropertyConfig['allowedSubProperties'] ?? []) as $allowedSubProperty => $allowedSubPropertyConfig) {
$propertyKey = is_array($allowedSubPropertyConfig) ? $allowedSubProperty : $allowedSubPropertyConfig; $propertyKey = is_array($allowedSubPropertyConfig) ? $allowedSubProperty : $allowedSubPropertyConfig;
if ($property === $handledProperty . $this->subPropertySeparator . $propertyKey) { if ($property === $handledProperty . $this->subPropertySeparator . $propertyKey) {
return true; return true;
......
...@@ -2140,14 +2140,14 @@ class PageRenderer implements SingletonInterface ...@@ -2140,14 +2140,14 @@ class PageRenderer implements SingletonInterface
*/ */
private function createCssTag(array $properties, string $file): string private function createCssTag(array $properties, string $file): string
{ {
if ($properties['inline'] && @is_file($file)) { if (($properties['inline'] ?? false) && @is_file($file)) {
$tag = $this->createInlineCssTagFromFile($file, $properties); $tag = $this->createInlineCssTagFromFile($file, $properties);
} else { } else {
$href = $this->getStreamlinedFileName($file); $href = $this->getStreamlinedFileName($file);
$tag = '<link rel="' . htmlspecialchars($properties['rel']) $tag = '<link rel="' . htmlspecialchars($properties['rel'])
. '" href="' . htmlspecialchars($href) . '" href="' . htmlspecialchars($href)
. '" media="' . htmlspecialchars($properties['media']) . '"' . '" media="' . htmlspecialchars($properties['media']) . '"'
. ($properties['title'] ? ' title="' . htmlspecialchars($properties['title']) . '"' : '') . (($properties['title'] ?? false) ? ' title="' . htmlspecialchars($properties['title']) . '"' : '')
. $this->endingSlash . '>'; . $this->endingSlash . '>';
} }
if ($properties['allWrap']) { if ($properties['allWrap']) {
...@@ -2240,10 +2240,10 @@ class PageRenderer implements SingletonInterface ...@@ -2240,10 +2240,10 @@ class PageRenderer implements SingletonInterface
$file = $this->getStreamlinedFileName($file); $file = $this->getStreamlinedFileName($file);
$type = $properties['type'] ? ' type="' . htmlspecialchars($properties['type']) . '"' : ''; $type = $properties['type'] ? ' type="' . htmlspecialchars($properties['type']) . '"' : '';
$async = $properties['async'] ? ' async="async"' : ''; $async = $properties['async'] ? ' async="async"' : '';
$defer = $properties['defer'] ? ' defer="defer"' : ''; $defer = ($properties['defer'] ?? false) ? ' defer="defer"' : '';
$nomodule = $properties['nomodule'] ? ' nomodule="nomodule"' : ''; $nomodule = ($properties['nomodule'] ?? false) ? ' nomodule="nomodule"' : '';
$integrity = $properties['integrity'] ? ' integrity="' . htmlspecialchars($properties['integrity']) . '"' : ''; $integrity = ($properties['integrity'] ?? false) ? ' integrity="' . htmlspecialchars($properties['integrity']) . '"' : '';
$crossorigin = $properties['crossorigin'] ? ' crossorigin="' . htmlspecialchars($properties['crossorigin']) . '"' : ''; $crossorigin = ($properties['crossorigin'] ?? false) ? ' crossorigin="' . htmlspecialchars($properties['crossorigin']) . '"' : '';
$tag = '<script src="' . htmlspecialchars($file) . '"' . $type . $async . $defer . $integrity . $crossorigin . $nomodule . '></script>'; $tag = '<script src="' . htmlspecialchars($file) . '"' . $type . $async . $defer . $integrity . $crossorigin . $nomodule . '></script>';
if ($properties['allWrap']) { if ($properties['allWrap']) {
$wrapArr = explode($properties['splitChar'] ?: '|', $properties['allWrap'], 2); $wrapArr = explode($properties['splitChar'] ?: '|', $properties['allWrap'], 2);
......
...@@ -372,7 +372,7 @@ class TemplateService ...@@ -372,7 +372,7 @@ class TemplateService
if (is_array($cc['all'])) { if (is_array($cc['all'])) {
/** @var ConditionMatcher $matchObj */ /** @var ConditionMatcher $matchObj */
$matchObj = GeneralUtility::makeInstance(ConditionMatcher::class); $matchObj = GeneralUtility::makeInstance(ConditionMatcher::class);
$matchObj->setRootline((array)$cc['rootLine']); $matchObj->setRootline((array)($cc['rootLine'] ?? []));
$sectionsMatch = []; $sectionsMatch = [];
foreach ($cc['all'] as $key => $pre) { foreach ($cc['all'] as $key => $pre) {
if ($matchObj->match($pre)) { if ($matchObj->match($pre)) {
...@@ -1263,7 +1263,7 @@ class TemplateService ...@@ -1263,7 +1263,7 @@ class TemplateService
*/ */
protected function getTypoScriptFrontendController() protected function getTypoScriptFrontendController()
{ {
return $this->frontendController ?? $GLOBALS['TSFE']; return $this->frontendController ?? $GLOBALS['TSFE'] ?? null;
} }
/** /**
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
defined('TYPO3') or die(); defined('TYPO3') or die();
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['dashboard_rss'])) { if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['dashboard_rss'] ?? null)) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['dashboard_rss'] = [ $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['dashboard_rss'] = [
'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, 'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class,
'backend' => \TYPO3\CMS\Core\Cache\Backend\FileBackend::class, 'backend' => \TYPO3\CMS\Core\Cache\Backend\FileBackend::class,
......
...@@ -131,7 +131,7 @@ class ConfigurationManager extends ExtbaseConfigurationManager implements Config ...@@ -131,7 +131,7 @@ class ConfigurationManager extends ExtbaseConfigurationManager implements Config
protected function overrideConfigurationByTypoScript(array $yamlSettings, string $extensionName): array protected function overrideConfigurationByTypoScript(array $yamlSettings, string $extensionName): array
{ {
$typoScript = parent::getConfiguration(self::CONFIGURATION_TYPE_SETTINGS, $extensionName); $typoScript = parent::getConfiguration(self::CONFIGURATION_TYPE_SETTINGS, $extensionName);
if (is_array($typoScript['yamlSettingsOverrides']) && !empty($typoScript['yamlSettingsOverrides'])) { if (is_array($typoScript['yamlSettingsOverrides'] ?? null) && !empty($typoScript['yamlSettingsOverrides'])) {
ArrayUtility::mergeRecursiveWithOverrule( ArrayUtility::mergeRecursiveWithOverrule(
$yamlSettings, $yamlSettings,
$typoScript['yamlSettingsOverrides'] $typoScript['yamlSettingsOverrides']
......
...@@ -674,7 +674,7 @@ class ContentObjectRenderer implements LoggerAwareInterface ...@@ -674,7 +674,7 @@ class ContentObjectRenderer implements LoggerAwareInterface
foreach ($sKeyArray as $theKey) { foreach ($sKeyArray as $theKey) {
$theValue = $setup[$theKey]; $theValue = $setup[$theKey];
if ((int)$theKey && strpos($theKey, '.') === false) { if ((int)$theKey && strpos($theKey, '.') === false) {
$conf = $setup[$theKey . '.']; $conf = $setup[$theKey . '.'] ?? [];
$content .= $this->cObjGetSingle($theValue, $conf, $addKey . $theKey); $content .= $this->cObjGetSingle($theValue, $conf, $addKey . $theKey);
} }
} }
......
...@@ -42,7 +42,11 @@ class HierarchicalMenuContentObject extends AbstractContentObject ...@@ -42,7 +42,11 @@ class HierarchicalMenuContentObject extends AbstractContentObject
/** @var Menu\MenuContentObjectFactory $menuObjectFactory */ /** @var Menu\MenuContentObjectFactory $menuObjectFactory */
$menuObjectFactory = GeneralUtility::makeInstance(MenuContentObjectFactory::class); $menuObjectFactory = GeneralUtility::makeInstance(MenuContentObjectFactory::class);
$menu = $menuObjectFactory->getMenuObjectByType($menuType); $menu = $menuObjectFactory->getMenuObjectByType($menuType);
if (isset($GLOBALS['TSFE']->register['count_HMENU'])) {
$GLOBALS['TSFE']->register['count_HMENU']++; $GLOBALS['TSFE']->register['count_HMENU']++;
} else {
$GLOBALS['TSFE']->register['count_HMENU'] = 1;
}
$GLOBALS['TSFE']->register['count_HMENU_MENUOBJ'] = 0; $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ'] = 0;
$GLOBALS['TSFE']->register['count_MENUOBJ'] = 0; $GLOBALS['TSFE']->register['count_MENUOBJ'] = 0;
$menu->parent_cObj = $this->cObj; $menu->parent_cObj = $this->cObj;
......
...@@ -246,7 +246,7 @@ abstract class AbstractMenuContentObject ...@@ -246,7 +246,7 @@ abstract class AbstractMenuContentObject
// includeNotInMenu initialized: // includeNotInMenu initialized:
$this->conf['includeNotInMenu'] = $this->parent_cObj->stdWrapValue('includeNotInMenu', $this->conf, false); $this->conf['includeNotInMenu'] = $this->parent_cObj->stdWrapValue('includeNotInMenu', $this->conf, false);
// exclude doktypes that should not be shown in menu (e.g. backend user section) // exclude doktypes that should not be shown in menu (e.g. backend user section)
if ($this->conf['excludeDoktypes']) { if ($this->conf['excludeDoktypes'] ?? false) {
$this->excludedDoktypes = GeneralUtility::intExplode(',', $this->conf['excludeDoktypes']); $this->excludedDoktypes = GeneralUtility::intExplode(',', $this->conf['excludeDoktypes']);
} }
// EntryLevel // EntryLevel
...@@ -265,7 +265,7 @@ abstract class AbstractMenuContentObject ...@@ -265,7 +265,7 @@ abstract class AbstractMenuContentObject
// (MP var for ->id is picked up in the next part of the code...) // (MP var for ->id is picked up in the next part of the code...)
foreach ($this->tmpl->rootLine as $entryLevel => $levelRec) { foreach ($this->tmpl->rootLine as $entryLevel => $levelRec) {
// For overlaid mount points, set the variable right now: // For overlaid mount points, set the variable right now:
if ($levelRec['_MP_PARAM'] && $levelRec['_MOUNT_OL']) { if (($levelRec['_MP_PARAM'] ?? false) && ($levelRec['_MOUNT_OL'] ?? false)) {
$this->MP_array[] = $levelRec['_MP_PARAM']; $this->MP_array[] = $levelRec['_MP_PARAM'];
} }
// Break when entry level is reached: // Break when entry level is reached:
...@@ -296,7 +296,7 @@ abstract class AbstractMenuContentObject ...@@ -296,7 +296,7 @@ abstract class AbstractMenuContentObject
$rl_MParray = []; $rl_MParray = [];
foreach ($this->tmpl->rootLine as $v_rl) { foreach ($this->tmpl->rootLine as $v_rl) {
// For overlaid mount points, set the variable right now: // For overlaid mount points, set the variable right now:
if ($v_rl['_MP_PARAM'] && $v_rl['_MOUNT_OL']) { if (($v_rl['_MP_PARAM'] ?? false) && ($v_rl['_MOUNT_OL'] ?? false)) {
$rl_MParray[] = $v_rl['_MP_PARAM']; $rl_MParray[] = $v_rl['_MP_PARAM'];
} }
// Add to register: // Add to register:
...@@ -307,7 +307,7 @@ abstract class AbstractMenuContentObject ...@@ -307,7 +307,7 @@ abstract class AbstractMenuContentObject
: '' : ''
); );
// For normal mount points, set the variable for next level. // For normal mount points, set the variable for next level.
if ($v_rl['_MP_PARAM'] && !$v_rl['_MOUNT_OL']) { if (($v_rl['_MP_PARAM'] ?? false) && !($v_rl['_MOUNT_OL'] ?? false)) {
$rl_MParray[] = $v_rl['_MP_PARAM']; $rl_MParray[] = $v_rl['_MP_PARAM'];
} }
} }
...@@ -326,7 +326,7 @@ abstract class AbstractMenuContentObject ...@@ -326,7 +326,7 @@ abstract class AbstractMenuContentObject
// Notice: The automatic expansion of a menu is designed to work only when no "special" modes (except "directory") are used. // Notice: The automatic expansion of a menu is designed to work only when no "special" modes (except "directory") are used.
$startLevel = $directoryLevel ?: $this->entryLevel; $startLevel = $directoryLevel ?: $this->entryLevel;
$currentLevel = $startLevel + $this->menuNumber; $currentLevel = $startLevel + $this->menuNumber;
if (is_array($this->tmpl->rootLine[$currentLevel])) { if (is_array($this->tmpl->rootLine[$currentLevel] ?? null)) {
$nextMParray = $this->MP_array; $nextMParray = $this->MP_array;
if (empty($nextMParray) && !$this->tmpl->rootLine[$currentLevel]['_MOUNT_OL'] && $currentLevel > 0) { if (empty($nextMParray) && !$this->tmpl->rootLine[$currentLevel]['_MOUNT_OL'] && $currentLevel > 0) {
// Make sure to slide-down any mount point information (_MP_PARAM) to children records in the rootline // Make sure to slide-down any mount point information (_MP_PARAM) to children records in the rootline
...@@ -369,7 +369,7 @@ abstract class AbstractMenuContentObject ...@@ -369,7 +369,7 @@ abstract class AbstractMenuContentObject
// Initializing showAccessRestrictedPages // Initializing showAccessRestrictedPages
$SAVED_where_groupAccess = ''; $SAVED_where_groupAccess = '';
if ($this->mconf['showAccessRestrictedPages']) { if ($this->mconf['showAccessRestrictedPages'] ?? false) {
// SAVING where_groupAccess // SAVING where_groupAccess
$SAVED_where_groupAccess = $this->sys_page->where_groupAccess; $SAVED_where_groupAccess = $this->sys_page->where_groupAccess;
// Temporarily removing fe_group checking! // Temporarily removing fe_group checking!
...@@ -380,9 +380,10 @@ abstract class AbstractMenuContentObject ...@@ -380,9 +380,10 @@ abstract class AbstractMenuContentObject
$c = 0; $c = 0;
$c_b = 0; $c_b = 0;
$minItems = (int)($this->mconf['minItems'] ?: $this->conf['minItems']);
$maxItems = (int)($this->mconf['maxItems'] ?: $this->conf['maxItems']); $minItems = (int)(($this->mconf['minItems'] ?? 0) ?: ($this->conf['minItems'] ?? 0));
$begin = $this->parent_cObj->calc($this->mconf['begin'] ?: $this->conf['begin']); $maxItems = (int)(($this->mconf['maxItems'] ?? 0) ?: ($this->conf['maxItems'] ?? 0));
$begin = $this->parent_cObj->calc(($this->mconf['begin'] ?? 0) ?: ($this->conf['begin'] ?? 0));
$minItemsConf = $this->mconf['minItems.'] ?? $this->conf['minItems.'] ?? null; $minItemsConf = $this->mconf['minItems.'] ?? $this->conf['minItems.'] ?? null;
$minItems = is_array($minItemsConf) ? $this->parent_cObj->stdWrap($minItems, $minItemsConf) : $minItems; $minItems = is_array($minItemsConf) ? $this->parent_cObj->stdWrap($minItems, $minItemsConf) : $minItems;
$maxItemsConf = $this->mconf['maxItems.'] ?? $this->conf['maxItems.'] ?? null; $maxItemsConf = $this->mconf['maxItems.'] ?? $this->conf['maxItems.'] ?? null;
...@@ -419,7 +420,7 @@ abstract class AbstractMenuContentObject ...@@ -419,7 +420,7 @@ abstract class AbstractMenuContentObject
} }
} }
// Passing the menuArr through a user defined function: // Passing the menuArr through a user defined function:
if ($this->mconf['itemArrayProcFunc']) { if ($this->mconf['itemArrayProcFunc'] ?? false) {
$this->menuArr = $this->userProcess('itemArrayProcFunc', $this->menuArr); $this->menuArr = $this->userProcess('itemArrayProcFunc', $this->menuArr);
} }
// Setting number of menu items // Setting number of menu items
...@@ -431,7 +432,7 @@ abstract class AbstractMenuContentObject ...@@ -431,7 +432,7 @@ abstract class AbstractMenuContentObject
json_encode($this->MP_array) json_encode($this->MP_array)
); );
// Get the cache timeout: // Get the cache timeout:
if ($this->conf['cache_period']) { if ($this->conf['cache_period'] ?? false) {
$cacheTimeout = $this->conf['cache_period']; $cacheTimeout = $this->conf['cache_period'];
} else { } else {
$cacheTimeout = $this->getTypoScriptFrontendController()->get_cache_timeout(); $cacheTimeout = $this->getTypoScriptFrontendController()->get_cache_timeout();
...@@ -445,7 +446,7 @@ abstract class AbstractMenuContentObject ...@@ -445,7 +446,7 @@ abstract class AbstractMenuContentObject
$this->result = $cachedData; $this->result = $cachedData;
} }
// End showAccessRestrictedPages // End showAccessRestrictedPages
if ($this->mconf['showAccessRestrictedPages']) { if ($this->mconf['showAccessRestrictedPages'] ?? false) {
// RESTORING where_groupAccess // RESTORING where_groupAccess
$this->sys_page->where_groupAccess = $SAVED_where_groupAccess; $this->sys_page->where_groupAccess = $SAVED_where_groupAccess;
} }
...@@ -494,7 +495,7 @@ abstract class AbstractMenuContentObject ...@@ -494,7 +495,7 @@ abstract class AbstractMenuContentObject
protected function prepareMenuItems() protected function prepareMenuItems()
{ {
$menuItems = []; $menuItems = [];
$alternativeSortingField = trim($this->mconf['alternativeSortingField']) ?: 'sorting'; $alternativeSortingField = trim($this->mconf['alternativeSortingField'] ?? '') ?: 'sorting';
// Additional where clause, usually starts with AND (as usual with all additionalWhere functionality in TS) // Additional where clause, usually starts with AND (as usual with all additionalWhere functionality in TS)
$additionalWhere = $this->parent_cObj->stdWrapValue('additionalWhere', $this->mconf ?? []); $additionalWhere = $this->parent_cObj->stdWrapValue('additionalWhere', $this->mconf ?? []);
...@@ -540,7 +541,7 @@ abstract class AbstractMenuContentObject ...@@ -540,7 +541,7 @@ abstract class AbstractMenuContentObject
$menuItems = $this->prepareMenuItemsForBrowseMenu($value, $alternativeSortingField, $additionalWhere); $menuItems = $this->prepareMenuItemsForBrowseMenu($value, $alternativeSortingField, $additionalWhere);
break; break;
} }
if ($this->mconf['sectionIndex']) { if ($this->mconf['sectionIndex'] ?? false) {
$sectionIndexes = []; $sectionIndexes = [];
foreach ($menuItems as $page) { foreach ($menuItems as $page) {
$sectionIndexes = $sectionIndexes + $this->sectionIndex($alternativeSortingField, $page['uid']); $sectionIndexes = $sectionIndexes + $this->sectionIndex($alternativeSortingField, $page['uid']);
...@@ -613,7 +614,7 @@ abstract class AbstractMenuContentObject ...@@ -613,7 +614,7 @@ abstract class AbstractMenuContentObject
if ($pageTranslationVisibility->shouldHideTranslationIfNoTranslatedRecordExists() && $sUid && if ($pageTranslationVisibility->shouldHideTranslationIfNoTranslatedRecordExists() && $sUid &&
empty($lRecs) || $pageTranslationVisibility->shouldBeHiddenInDefaultLanguage() && empty($lRecs) || $pageTranslationVisibility->shouldBeHiddenInDefaultLanguage() &&
(!$sUid || empty($lRecs)) || (!$sUid || empty($lRecs)) ||
!$this->conf['special.']['normalWhenNoLanguage'] && $sUid && empty($lRecs) !($this->conf['special.']['normalWhenNoLanguage'] ?? false) && $sUid && empty($lRecs)
) { ) {
$iState = $currentLanguageId === $sUid ? 'USERDEF2' : 'USERDEF1'; $iState = $currentLanguageId === $sUid ? 'USERDEF2' : 'USERDEF1';
} else { } else {
...@@ -1297,7 +1298,7 @@ abstract class AbstractMenuContentObject ...@@ -1297,7 +1298,7 @@ abstract class AbstractMenuContentObject
$tsfe = $this->getTypoScriptFrontendController(); $tsfe = $this->getTypoScriptFrontendController();
// If a user script returned the value overrideId in the menu array we use that as page id // If a user script returned the value overrideId in the menu array we use that as page id
if ($this->mconf['overrideId'] || $this->menuArr[$key]['overrideId']) { if (($this->mconf['overrideId'] ?? false) || ($this->menuArr[$key]['overrideId'] ?? false)) {
$overrideId = (int)($this->mconf['overrideId'] ?: $this->menuArr[$key]['overrideId']); $overrideId = (int)($this->mconf['overrideId'] ?: $this->menuArr[$key]['overrideId']);
$overrideId = $overrideId > 0 ? $overrideId : null; $overrideId = $overrideId > 0 ? $overrideId : null;
// Clear MP parameters since ID was changed. // Clear MP parameters since ID was changed.
...@@ -1314,13 +1315,13 @@ abstract class AbstractMenuContentObject ...@@ -1314,13 +1315,13 @@ abstract class AbstractMenuContentObject
$mainTarget = (string)$this->parent_cObj->stdWrapValue('target', $this->mconf ?? []); $mainTarget = (string)$this->parent_cObj->stdWrapValue('target', $this->mconf ?? []);
} }
// Creating link: // Creating link:
$addParams = $this->mconf['addParams'] . $MP_params; $addParams = ($this->mconf['addParams'] ?? '') . $MP_params;
if ($this->mconf['collapse'] && $this->isActive($this->menuArr[$key]['uid'], $this->getMPvar($key))) { if (($this->mconf['collapse'] ?? false) && $this->isActive($this->menuArr[$key]['uid'], $this->getMPvar($key))) {
$thePage = $this->sys_page->getPage($this->menuArr[$key]['pid']); $thePage = $this->sys_page->getPage($this->menuArr[$key]['pid']);
$addParams .= $this->menuArr[$key]['_ADD_GETVARS']; $addParams .= $this->menuArr[$key]['_ADD_GETVARS'];
$LD = $this->menuTypoLink($thePage, $mainTarget, $addParams, $typeOverride, $overrideId); $LD = $this->menuTypoLink($thePage, $mainTarget, $addParams, $typeOverride, $overrideId);
} else { } else {
$addParams .= $this->I['val']['additionalParams'] . $this->menuArr[$key]['_ADD_GETVARS']; $addParams .= ($this->I['val']['additionalParams'] ?? '') . $this->menuArr[$key]['_ADD_GETVARS'];
$LD = $this->menuTypoLink($this->menuArr[$key], $mainTarget, $addParams, $typeOverride, $overrideId); $LD = $this->menuTypoLink($this->menuArr[$key], $mainTarget, $addParams, $typeOverride, $overrideId);
} }
// Override default target configuration if option is set // Override default target configuration if option is set
...@@ -1377,7 +1378,7 @@ abstract class AbstractMenuContentObject ...@@ -1377,7 +1378,7 @@ abstract class AbstractMenuContentObject
// Manipulation in case of access restricted pages: // Manipulation in case of access restricted pages:
$this->changeLinksForAccessRestrictedPages($LD, $pageData, $mainTarget, $typeOverride); $this->changeLinksForAccessRestrictedPages($LD, $pageData, $mainTarget, $typeOverride);
// Overriding URL / Target if set to do so: // Overriding URL / Target if set to do so:
if ($this->menuArr[$key]['_OVERRIDE_HREF']) { if ($this->menuArr[$key]['_OVERRIDE_HREF'] ?? false) {
$LD['totalURL'] = $this->menuArr[$key]['_OVERRIDE_HREF']; $LD['totalURL'] = $this->menuArr[$key]['_OVERRIDE_HREF'];
if ($this->menuArr[$key]['_OVERRIDE_TARGET']) { if ($this->menuArr[$key]['_OVERRIDE_TARGET']) {
$LD['target'] = $this->menuArr[$key]['_OVERRIDE_TARGET']; $LD['target'] = $this->menuArr[$key]['_OVERRIDE_TARGET'];
...@@ -1385,7 +1386,7 @@ abstract class AbstractMenuContentObject ...@@ -1385,7 +1386,7 @@ abstract class AbstractMenuContentObject
} }
// OnClick open in windows. // OnClick open in windows.
$onClick = ''; $onClick = '';