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']
// 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] = [];
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'] = [];
}
......@@ -246,7 +246,7 @@ class BackendModuleRepository implements SingletonInterface
$dummyScript = (string)$uriBuilder->buildUriFromRoute('dummy');
foreach ($loadedModules as $moduleName => $moduleData) {
$moduleLink = '';
if (!is_array($moduleData['sub'])) {
if (!is_array($moduleData['sub'] ?? null)) {
$moduleLink = $moduleData['script'];
}
$moduleLink = GeneralUtility::resolveBackPath($moduleLink);
......@@ -259,7 +259,7 @@ class BackendModuleRepository implements SingletonInterface
'icon' => $this->getModuleIcon($moduleKey, $moduleData),
'link' => $moduleLink,
'description' => $moduleLabels['shortdescription'],
'standalone' => (bool)$moduleData['standalone']
'standalone' => (bool)($moduleData['standalone'] ?? false)
];
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
......@@ -275,7 +275,7 @@ class BackendModuleRepository implements SingletonInterface
'navigationFrameScriptParam' => null,
'navigationComponentId' => null
];
} elseif (is_array($moduleData['sub'])) {
} elseif (is_array($moduleData['sub'] ?? null)) {
foreach ($moduleData['sub'] as $submoduleName => $submoduleData) {
if (isset($submoduleData['script'])) {
$submoduleLink = GeneralUtility::resolveBackPath($submoduleData['script']);
......@@ -286,7 +286,7 @@ class BackendModuleRepository implements SingletonInterface
$submoduleLabels = $moduleLoader->getLabelsForModule($submoduleKey);
$submoduleDescription = $submoduleLabels['shortdescription'];
$originalLink = $submoduleLink;
$navigationFrameScript = $submoduleData['navFrameScript'];
$navigationFrameScript = $submoduleData['navFrameScript'] ?? null;
$modules[$moduleKey]['subitems'][$submoduleKey] = [
'name' => $moduleName . '_' . $submoduleName,
'title' => $submoduleLabels['title'],
......@@ -296,12 +296,12 @@ class BackendModuleRepository implements SingletonInterface
'originalLink' => $originalLink,
'description' => $submoduleDescription,
'navigationFrameScript' => $navigationFrameScript,
'navigationFrameScriptParam' => $submoduleData['navFrameScriptParam'],
'navigationComponentId' => $submoduleData['navigationComponentId']
'navigationFrameScriptParam' => $submoduleData['navFrameScriptParam'] ?? null,
'navigationComponentId' => $submoduleData['navigationComponentId'] ?? null
];
// 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)
if ($moduleData['navFrameScript'] && $submoduleData['inheritNavigationComponentFromMainModule'] !== false) {
if (($moduleData['navFrameScript'] ?? false) && $submoduleData['inheritNavigationComponentFromMainModule'] !== false) {
$modules[$moduleKey]['subitems'][$submoduleKey]['parentNavigationFrameScript'] = $moduleData['navFrameScript'];
}
}
......
......@@ -584,7 +584,7 @@ class ModuleTemplate
$getParams = GeneralUtility::_GET();
$storeArray = array_merge(
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, '&');
}
......
......@@ -3580,9 +3580,9 @@ class BackendUtility
{
$simUser = '';
$simTime = '';
if ($pageInfo['fe_group'] > 0) {
if (($pageInfo['fe_group'] ?? 0) > 0) {
$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.
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('fe_groups');
......@@ -3600,8 +3600,8 @@ class BackendUtility
$simUser = '&ADMCMD_simUser=' . $activeFeGroupRow['uid'];
}
}
$startTime = (int)$pageInfo['starttime'];
$endTime = (int)$pageInfo['endtime'];
$startTime = (int)($pageInfo['starttime'] ?? 0);
$endTime = (int)($pageInfo['endtime'] ?? 0);
if ($startTime > $GLOBALS['EXEC_TIME']) {
// simulate access time to ensure PageRepository will find the page and in turn PageRouter will generate
// an URL for it
......
......@@ -1221,7 +1221,7 @@ class BackendUserAuthentication extends AbstractUserAuthentication
// Enabled Backend Modules
$this->groupData['modules'] = $this->user['userMods'];
// Add available widgets
$this->groupData['available_widgets'] = $this->user['available_widgets'];
$this->groupData['available_widgets'] = $this->user['available_widgets'] ?? '';
// Add Allowed Languages
$this->groupData['allowed_languages'] = $this->user['allowed_languages'];
// Set user value for workspace permissions.
......
......@@ -295,7 +295,7 @@ abstract class AbstractMetaTagManager implements MetaTagManagerInterface
}
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;
if ($property === $handledProperty . $this->subPropertySeparator . $propertyKey) {
return true;
......
......@@ -2140,14 +2140,14 @@ class PageRenderer implements SingletonInterface
*/
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);
} else {
$href = $this->getStreamlinedFileName($file);
$tag = '<link rel="' . htmlspecialchars($properties['rel'])
. '" href="' . htmlspecialchars($href)
. '" media="' . htmlspecialchars($properties['media']) . '"'
. ($properties['title'] ? ' title="' . htmlspecialchars($properties['title']) . '"' : '')
. (($properties['title'] ?? false) ? ' title="' . htmlspecialchars($properties['title']) . '"' : '')
. $this->endingSlash . '>';
}
if ($properties['allWrap']) {
......@@ -2240,10 +2240,10 @@ class PageRenderer implements SingletonInterface
$file = $this->getStreamlinedFileName($file);
$type = $properties['type'] ? ' type="' . htmlspecialchars($properties['type']) . '"' : '';
$async = $properties['async'] ? ' async="async"' : '';
$defer = $properties['defer'] ? ' defer="defer"' : '';
$nomodule = $properties['nomodule'] ? ' nomodule="nomodule"' : '';
$integrity = $properties['integrity'] ? ' integrity="' . htmlspecialchars($properties['integrity']) . '"' : '';
$crossorigin = $properties['crossorigin'] ? ' crossorigin="' . htmlspecialchars($properties['crossorigin']) . '"' : '';
$defer = ($properties['defer'] ?? false) ? ' defer="defer"' : '';
$nomodule = ($properties['nomodule'] ?? false) ? ' nomodule="nomodule"' : '';
$integrity = ($properties['integrity'] ?? false) ? ' integrity="' . htmlspecialchars($properties['integrity']) . '"' : '';
$crossorigin = ($properties['crossorigin'] ?? false) ? ' crossorigin="' . htmlspecialchars($properties['crossorigin']) . '"' : '';
$tag = '<script src="' . htmlspecialchars($file) . '"' . $type . $async . $defer . $integrity . $crossorigin . $nomodule . '></script>';
if ($properties['allWrap']) {
$wrapArr = explode($properties['splitChar'] ?: '|', $properties['allWrap'], 2);
......
......@@ -372,7 +372,7 @@ class TemplateService
if (is_array($cc['all'])) {
/** @var ConditionMatcher $matchObj */
$matchObj = GeneralUtility::makeInstance(ConditionMatcher::class);
$matchObj->setRootline((array)$cc['rootLine']);
$matchObj->setRootline((array)($cc['rootLine'] ?? []));
$sectionsMatch = [];
foreach ($cc['all'] as $key => $pre) {
if ($matchObj->match($pre)) {
......@@ -1263,7 +1263,7 @@ class TemplateService
*/
protected function getTypoScriptFrontendController()
{
return $this->frontendController ?? $GLOBALS['TSFE'];
return $this->frontendController ?? $GLOBALS['TSFE'] ?? null;
}
/**
......
......@@ -2,7 +2,7 @@
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'] = [
'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class,
'backend' => \TYPO3\CMS\Core\Cache\Backend\FileBackend::class,
......
......@@ -131,7 +131,7 @@ class ConfigurationManager extends ExtbaseConfigurationManager implements Config
protected function overrideConfigurationByTypoScript(array $yamlSettings, string $extensionName): array
{
$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(
$yamlSettings,
$typoScript['yamlSettingsOverrides']
......
......@@ -674,7 +674,7 @@ class ContentObjectRenderer implements LoggerAwareInterface
foreach ($sKeyArray as $theKey) {
$theValue = $setup[$theKey];
if ((int)$theKey && strpos($theKey, '.') === false) {
$conf = $setup[$theKey . '.'];
$conf = $setup[$theKey . '.'] ?? [];
$content .= $this->cObjGetSingle($theValue, $conf, $addKey . $theKey);
}
}
......
......@@ -42,7 +42,11 @@ class HierarchicalMenuContentObject extends AbstractContentObject
/** @var Menu\MenuContentObjectFactory $menuObjectFactory */
$menuObjectFactory = GeneralUtility::makeInstance(MenuContentObjectFactory::class);
$menu = $menuObjectFactory->getMenuObjectByType($menuType);
$GLOBALS['TSFE']->register['count_HMENU']++;
if (isset($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_MENUOBJ'] = 0;
$menu->parent_cObj = $this->cObj;
......
......@@ -246,7 +246,7 @@ abstract class AbstractMenuContentObject
// includeNotInMenu initialized:
$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)
if ($this->conf['excludeDoktypes']) {
if ($this->conf['excludeDoktypes'] ?? false) {
$this->excludedDoktypes = GeneralUtility::intExplode(',', $this->conf['excludeDoktypes']);
}
// EntryLevel
......@@ -265,7 +265,7 @@ abstract class AbstractMenuContentObject
// (MP var for ->id is picked up in the next part of the code...)
foreach ($this->tmpl->rootLine as $entryLevel => $levelRec) {
// 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'];
}
// Break when entry level is reached:
......@@ -296,7 +296,7 @@ abstract class AbstractMenuContentObject
$rl_MParray = [];
foreach ($this->tmpl->rootLine as $v_rl) {
// 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'];
}
// Add to register:
......@@ -307,7 +307,7 @@ abstract class AbstractMenuContentObject
: ''
);
// 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'];
}
}
......@@ -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.
$startLevel = $directoryLevel ?: $this->entryLevel;
$currentLevel = $startLevel + $this->menuNumber;
if (is_array($this->tmpl->rootLine[$currentLevel])) {
if (is_array($this->tmpl->rootLine[$currentLevel] ?? null)) {
$nextMParray = $this->MP_array;
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
......@@ -369,7 +369,7 @@ abstract class AbstractMenuContentObject
// Initializing showAccessRestrictedPages
$SAVED_where_groupAccess = '';
if ($this->mconf['showAccessRestrictedPages']) {
if ($this->mconf['showAccessRestrictedPages'] ?? false) {
// SAVING where_groupAccess
$SAVED_where_groupAccess = $this->sys_page->where_groupAccess;
// Temporarily removing fe_group checking!
......@@ -380,9 +380,10 @@ abstract class AbstractMenuContentObject
$c = 0;
$c_b = 0;
$minItems = (int)($this->mconf['minItems'] ?: $this->conf['minItems']);
$maxItems = (int)($this->mconf['maxItems'] ?: $this->conf['maxItems']);
$begin = $this->parent_cObj->calc($this->mconf['begin'] ?: $this->conf['begin']);
$minItems = (int)(($this->mconf['minItems'] ?? 0) ?: ($this->conf['minItems'] ?? 0));
$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;
$minItems = is_array($minItemsConf) ? $this->parent_cObj->stdWrap($minItems, $minItemsConf) : $minItems;
$maxItemsConf = $this->mconf['maxItems.'] ?? $this->conf['maxItems.'] ?? null;
......@@ -419,7 +420,7 @@ abstract class AbstractMenuContentObject
}
}
// Passing the menuArr through a user defined function:
if ($this->mconf['itemArrayProcFunc']) {
if ($this->mconf['itemArrayProcFunc'] ?? false) {
$this->menuArr = $this->userProcess('itemArrayProcFunc', $this->menuArr);
}
// Setting number of menu items
......@@ -431,7 +432,7 @@ abstract class AbstractMenuContentObject
json_encode($this->MP_array)
);
// Get the cache timeout:
if ($this->conf['cache_period']) {
if ($this->conf['cache_period'] ?? false) {
$cacheTimeout = $this->conf['cache_period'];
} else {
$cacheTimeout = $this->getTypoScriptFrontendController()->get_cache_timeout();
......@@ -445,7 +446,7 @@ abstract class AbstractMenuContentObject
$this->result = $cachedData;
}
// End showAccessRestrictedPages
if ($this->mconf['showAccessRestrictedPages']) {
if ($this->mconf['showAccessRestrictedPages'] ?? false) {
// RESTORING where_groupAccess
$this->sys_page->where_groupAccess = $SAVED_where_groupAccess;
}
......@@ -494,7 +495,7 @@ abstract class AbstractMenuContentObject
protected function prepareMenuItems()
{
$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)
$additionalWhere = $this->parent_cObj->stdWrapValue('additionalWhere', $this->mconf ?? []);
......@@ -540,7 +541,7 @@ abstract class AbstractMenuContentObject
$menuItems = $this->prepareMenuItemsForBrowseMenu($value, $alternativeSortingField, $additionalWhere);
break;
}
if ($this->mconf['sectionIndex']) {
if ($this->mconf['sectionIndex'] ?? false) {
$sectionIndexes = [];
foreach ($menuItems as $page) {
$sectionIndexes = $sectionIndexes + $this->sectionIndex($alternativeSortingField, $page['uid']);
......@@ -613,7 +614,7 @@ abstract class AbstractMenuContentObject
if ($pageTranslationVisibility->shouldHideTranslationIfNoTranslatedRecordExists() && $sUid &&
empty($lRecs) || $pageTranslationVisibility->shouldBeHiddenInDefaultLanguage() &&
(!$sUid || empty($lRecs)) ||
!$this->conf['special.']['normalWhenNoLanguage'] && $sUid && empty($lRecs)
!($this->conf['special.']['normalWhenNoLanguage'] ?? false) && $sUid && empty($lRecs)
) {
$iState = $currentLanguageId === $sUid ? 'USERDEF2' : 'USERDEF1';
} else {
......@@ -1297,7 +1298,7 @@ abstract class AbstractMenuContentObject
$tsfe = $this->getTypoScriptFrontendController();
// 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 = $overrideId > 0 ? $overrideId : null;
// Clear MP parameters since ID was changed.
......@@ -1314,13 +1315,13 @@ abstract class AbstractMenuContentObject
$mainTarget = (string)$this->parent_cObj->stdWrapValue('target', $this->mconf ?? []);
}
// Creating link:
$addParams = $this->mconf['addParams'] . $MP_params;
if ($this->mconf['collapse'] && $this->isActive($this->menuArr[$key]['uid'], $this->getMPvar($key))) {
$addParams = ($this->mconf['addParams'] ?? '') . $MP_params;
if (($this->mconf['collapse'] ?? false) && $this->isActive($this->menuArr[$key]['uid'], $this->getMPvar($key))) {
$thePage = $this->sys_page->getPage($this->menuArr[$key]['pid']);
$addParams .= $this->menuArr[$key]['_ADD_GETVARS'];
$LD = $this->menuTypoLink($thePage, $mainTarget, $addParams, $typeOverride, $overrideId);
} 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);
}
// Override default target configuration if option is set
......@@ -1377,7 +1378,7 @@ abstract class AbstractMenuContentObject
// Manipulation in case of access restricted pages:
$this->changeLinksForAccessRestrictedPages($LD, $pageData, $mainTarget, $typeOverride);
// 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'];
if ($this->menuArr[$key]['_OVERRIDE_TARGET']) {
$LD['target'] = $this->menuArr[$key]['_OVERRIDE_TARGET'];
......@@ -1385,7 +1386,7 @@ abstract class AbstractMenuContentObject
}
// OnClick open in windows.
$onClick = '';
if ($this->mconf['JSWindow']) {
if ($this->mconf['JSWindow'] ?? false) {
$conf = $this->mconf['JSWindow.'];
$url = $LD['totalURL'];
$LD['totalURL'] = '#';
......@@ -1405,12 +1406,12 @@ abstract class AbstractMenuContentObject
$targetIsType = $LD['target'] && MathUtility::canBeInterpretedAsInteger($LD['target']) ? (int)$LD['target'] : false;
if (preg_match('/([0-9]+[\\s])?(([0-9]+)x([0-9]+))?(:.+)?/s', $LD['target'], $matches) || $targetIsType) {
// has type?
if ((int)$matches[1] || $targetIsType) {
if ((int)($matches[1] ?? 0) || $targetIsType) {
$LD['totalURL'] .= (strpos($LD['totalURL'], '?') === false ? '?' : '&') . 'type=' . ($targetIsType ?: (int)$matches[1]);
$LD['target'] = $targetIsType ? '' : trim(substr($LD['target'], strlen($matches[1]) + 1));
}
// Open in popup window?
if ($matches[3] && $matches[4]) {
if (($matches[3] ?? false) && ($matches[4] ?? false)) {
$target = $LD['target'] ?? 'FEopenLink';
$JSparamWH = 'width=' . $matches[3] . ',height=' . $matches[4] . ($matches[5] ? ',' . substr($matches[5], 1) : '');
$onClick = 'vHWin=window.open('
......@@ -1472,7 +1473,7 @@ abstract class AbstractMenuContentObject
protected function changeLinksForAccessRestrictedPages(&$LD, $page, $mainTarget, $typeOverride)
{
// If access restricted pages should be shown in menus, change the link of such pages to link to a redirection page:
if ($this->mconf['showAccessRestrictedPages'] && $this->mconf['showAccessRestrictedPages'] !== 'NONE' && !$this->getTypoScriptFrontendController()->checkPageGroupAccess($page)) {
if ($this->mconf['showAccessRestrictedPages'] ?? false && $this->mconf['showAccessRestrictedPages'] !== 'NONE' && !$this->getTypoScriptFrontendController()->checkPageGroupAccess($page)) {
$thePage = $this->sys_page->getPage($this->mconf['showAccessRestrictedPages']);
$addParams = str_replace(
[
......@@ -1500,14 +1501,14 @@ abstract class AbstractMenuContentObject
{
// Setting alternative menu item array if _SUB_MENU has been defined in the current ->menuArr
$altArray = '';
if (is_array($this->menuArr[$this->I['key']]['_SUB_MENU']) && !empty($this->menuArr[$this->I['key']]['_SUB_MENU'])) {
if (is_array($this->menuArr[$this->I['key']]['_SUB_MENU'] ?? null) && !empty($this->menuArr[$this->I['key']]['_SUB_MENU'])) {
$altArray = $this->menuArr[$this->I['key']]['_SUB_MENU'];
}
// Make submenu if the page is the next active
$menuType = $this->conf[($this->menuNumber + 1) . $objSuffix];
$menuType = $this->conf[($this->menuNumber + 1) . $objSuffix] ?? '';
// stdWrap for expAll
$this->mconf['expAll'] = $this->parent_cObj->stdWrapValue('expAll', $this->mconf ?? []);
if (($this->mconf['expAll'] || $this->isNext($uid, $this->getMPvar($this->I['key'])) || is_array($altArray)) && !$this->mconf['sectionIndex']) {
if (($this->mconf['expAll'] || $this->isNext($uid, $this->getMPvar($this->I['key'])) || is_array($altArray)) && !($this->mconf['sectionIndex'] ?? false)) {
try {
$menuObjectFactory = GeneralUtility::makeInstance(MenuContentObjectFactory::class);
/** @var AbstractMenuContentObject $submenu */
......@@ -1738,7 +1739,7 @@ abstract class AbstractMenuContentObject
protected function userProcess($mConfKey, $passVar)
{
if ($this->mconf[$mConfKey]) {
$funcConf = $this->mconf[$mConfKey . '.'];
$funcConf = (array)($this->mconf[$mConfKey . '.'] ?? []);
$funcConf['parentObj'] = $this;
$passVar = $this->parent_cObj->callUserFunction($this->mconf[$mConfKey], $funcConf, $passVar);
}
......@@ -1780,7 +1781,7 @@ abstract class AbstractMenuContentObject
if ($GLOBALS['TYPO3_CONF_VARS']['FE']['enable_mount_pids']) {
$localMP_array = $this->MP_array;
// NOTICE: "_MP_PARAM" is allowed to be a commalist of PID pairs!
if ($this->menuArr[$key]['_MP_PARAM']) {
if ($this->menuArr[$key]['_MP_PARAM'] ?? false) {
$localMP_array[] = $this->menuArr[$key]['_MP_PARAM'];
}
return !empty($localMP_array) ? implode(',', $localMP_array) : '';
......
......@@ -61,7 +61,7 @@ class TextMenuContentObject extends AbstractMenuContentObject
$this->WMresult = '';
$this->WMmenuItems = count($this->result);
$typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
$this->WMsubmenuObjSuffixes = $typoScriptService->explodeConfigurationForOptionSplit(['sOSuffix' => $this->mconf['submenuObjSuffixes']], $this->WMmenuItems);
$this->WMsubmenuObjSuffixes = $typoScriptService->explodeConfigurationForOptionSplit(['sOSuffix' => $this->mconf['submenuObjSuffixes'] ?? null], $this->WMmenuItems);
foreach ($this->result as $key => $val) {
$GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']++;
$GLOBALS['TSFE']->register['count_MENUOBJ']++;
......@@ -78,7 +78,7 @@ class TextMenuContentObject extends AbstractMenuContentObject
$this->I['pid'] = $this->menuArr[$key]['pid'];
$this->I['spacer'] = $this->menuArr[$key]['isSpacer'];
// Set access key
if ($this->mconf['accessKey']) {
if ($this->mconf['accessKey'] ?? false) {
$this->I['accessKey'] = $this->accessKey((string)($this->I['title'] ?? ''));
} else {
$this->I['accessKey'] = [];
......@@ -110,14 +110,14 @@ class TextMenuContentObject extends AbstractMenuContentObject
$this->I['A2'] = '';
}
// ATagBeforeWrap processing:
if ($this->I['val']['ATagBeforeWrap']) {
if ($this->I['val']['ATagBeforeWrap'] ?? false) {
$wrapPartsBefore = explode('|', $this->I['val']['linkWrap']);
$wrapPartsAfter = ['', ''];
} else {
$wrapPartsBefore = ['', ''];
$wrapPartsAfter = explode('|', $this->I['val']['linkWrap']);
$wrapPartsAfter = explode('|', $this->I['val']['linkWrap'] ?? null);
}
if ($this->I['val']['stdWrap2'] || isset($this->I['val']['stdWrap2.'])) {
if (($this->I['val']['stdWrap2'] ?? false) || isset($this->I['val']['stdWrap2.'])) {
$stdWrap2 = isset($this->I['val']['stdWrap2.']) ? $this->WMcObj->stdWrap('|', $this->I['val']['stdWrap2.']) : '|';
$wrapPartsStdWrap = explode($this->I['val']['stdWrap2'] ?: '|', $stdWrap2);
} else {
......@@ -130,13 +130,13 @@ class TextMenuContentObject extends AbstractMenuContentObject
// stdWrap for doNotShowLink
$this->I['val']['doNotShowLink'] = $this->WMcObj->stdWrapValue('doNotShowLink', $this->I['val']);
if (!$this->I['val']['doNotShowLink']) {
$this->I['parts']['notATagBeforeWrap_begin'] = $wrapPartsAfter[0];
$this->I['parts']['notATagBeforeWrap_begin'] = $wrapPartsAfter[0] ?? '';
$this->I['parts']['ATag_begin'] = $this->I['A1'];
$this->I['parts']['ATagBeforeWrap_begin'] = $wrapPartsBefore[0];
$this->I['parts']['ATagBeforeWrap_begin'] = $wrapPartsBefore[0] ?? '';
$this->I['parts']['title'] = $this->I['title'];
$this->I['parts']['ATagBeforeWrap_end'] = $wrapPartsBefore[1];
$this->I['parts']['ATagBeforeWrap_end'] = $wrapPartsBefore[1] ?? '';
$this->I['parts']['ATag_end'] = $this->I['A2'];
$this->I['parts']['notATagBeforeWrap_end'] = $wrapPartsAfter[1];
$this->I['parts']['notATagBeforeWrap_end'] = $wrapPartsAfter[1] ?? '';
}
$this->I['parts']['stdWrap2_end'] = $wrapPartsStdWrap[1];
$this->I['parts']['after'] = $this->getBeforeAfter('after');
......@@ -149,11 +149,11 @@ class TextMenuContentObject extends AbstractMenuContentObject
// allWrap:
$allWrap = $this->WMcObj->stdWrapValue('allWrap', $this->I['val']);
$this->I['theItem'] = $this->WMcObj->wrap($this->I['theItem'], $allWrap);
if ($this->I['val']['subst_elementUid']) {
if ($this->I['val']['subst_elementUid'] ?? false) {
$this->I['theItem'] = str_replace('{elementUid}', $this->I['uid'], $this->I['theItem']);
}
// allStdWrap:
if (is_array($this->I['val']['allStdWrap.'])) {
if (is_array($this->I['val']['allStdWrap.'] ?? null)) {
$this->I['theItem'] = $this->WMcObj->stdWrap($this->I['theItem'], $this->I['val']['allStdWrap.']);
}
// Calling extra processing function
......@@ -193,7 +193,7 @@ class TextMenuContentObject extends AbstractMenuContentObject
{
// Add part to the accumulated result + fetch submenus
if (!$this->I['spacer']) {
$this->I['theItem'] .= $this->subMenu($this->I['uid'], $this->WMsubmenuObjSuffixes[$key]['sOSuffix']);
$this->I['theItem'] .= $this->subMenu($this->I['uid'], $this->WMsubmenuObjSuffixes[$key]['sOSuffix'] ?? '');
}
$part = $this->WMcObj->stdWrapValue('wrapItemAndSub', $this->I['val']);
$this->WMresult .= $part ? $this->WMcObj->wrap($this->I['theItem'], $part) : $this->I['theItem'];
......@@ -207,9 +207,9 @@ class TextMenuContentObject extends AbstractMenuContentObject
*/
protected function extProc_finish()
{
if (is_array($this->mconf['stdWrap.'])) {
if (is_array($this->mconf['stdWrap.'] ?? null)) {
$this->WMresult = $this->WMcObj->stdWrap($this->WMresult, $this->mconf['stdWrap.']);
}
return $this->WMcObj->wrap($this->WMresult, $this->mconf['wrap']);
return $this->WMcObj->wrap($this->WMresult, $this->mconf['wrap'] ?? '');
}
}
......@@ -1484,7 +1484,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
protected function getRelevantParametersForCachingFromPageArguments(PageArguments $pageArguments): array
{
$queryParams = $pageArguments->getDynamicArguments();
if (!empty($queryParams) && $pageArguments->getArguments()['cHash'] ?? false) {
if (!empty($queryParams) && ($pageArguments->getArguments()['cHash'] ?? false)) {
$queryParams['id'] = $pageArguments->getPageId();
return GeneralUtility::makeInstance(CacheHashCalculator::class)
->getRelevantParameters(HttpUtility::buildQueryString($queryParams));
......@@ -1654,7 +1654,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
}
$disableAcquireCacheData = false;
if ($this->isBackendUserLoggedIn()) {
if (strtolower($serverParams['HTTP_CACHE_CONTROL']) === 'no-cache' || strtolower($serverParams['HTTP_PRAGMA']) === 'no-cache') {
if (strtolower($serverParams['HTTP_CACHE_CONTROL'] ?? '') === 'no-cache' || strtolower($serverParams['HTTP_PRAGMA'] ?? '') === 'no-cache') {
$disableAcquireCacheData = true;
}
}
......@@ -1786,12 +1786,12 @@ class TypoScriptFrontendController implements LoggerAwareInterface
$this->config['config'] = [];
}
// Filling the config-array, first with the main "config." part
if (is_array($this->tmpl->setup['config.'])) {
if (is_array($this->tmpl->setup['config.'] ?? null))