diff --git a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php index 7c7b6560c5f3fdbe22ab631b80e02f4fd4648de8..07afbaeb2a7fc7d30774017f4b1b42f349581267 100644 --- a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php +++ b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php @@ -991,14 +991,14 @@ class PageLayoutController $this->buttonBar->addButton($shortcutButton); // Cache - if (!$this->modTSconfig['properties']['disableAdvanced']) { + if (empty($this->modTSconfig['properties']['disableAdvanced'])) { $clearCacheButton = $this->buttonBar->makeLinkButton() ->setHref(BackendUtility::getModuleUrl($this->moduleName, ['id' => $this->pageinfo['uid'], 'clear_cache' => '1'])) ->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.clear_cache')) ->setIcon($this->iconFactory->getIcon('actions-system-cache-clear', Icon::SIZE_SMALL)); $this->buttonBar->addButton($clearCacheButton, ButtonBar::BUTTON_POSITION_RIGHT, 1); } - if (!$this->modTSconfig['properties']['disableIconToolbar']) { + if (empty($this->modTSconfig['properties']['disableIconToolbar'])) { // Edit page properties and page language overlay icons if ($this->pageIsNotLockedForEditors() && $this->getBackendUser()->checkLanguageAccess(0)) { // Edit localized pages only when one specific language is selected diff --git a/typo3/sysext/backend/Classes/Module/ModuleLoader.php b/typo3/sysext/backend/Classes/Module/ModuleLoader.php index e742979ca2bae4e6488ed75c68c9100e496d8a76..aec015687cc560e535ecd7e3d95e52a397560603 100644 --- a/typo3/sysext/backend/Classes/Module/ModuleLoader.php +++ b/typo3/sysext/backend/Classes/Module/ModuleLoader.php @@ -139,7 +139,7 @@ class ModuleLoader public function checkMod($name) { // Check for own way of configuring module - if (is_array($GLOBALS['TBE_MODULES']['_configuration'][$name]['configureModuleFunction'])) { + if (is_array($GLOBALS['TBE_MODULES']['_configuration'][$name]['configureModuleFunction'] ?? false)) { trigger_error('Registering a module using "configureModuleFunction" is deprecated and will be removed in TYPO3 v10.', E_USER_DEPRECATED); $obj = $GLOBALS['TBE_MODULES']['_configuration'][$name]['configureModuleFunction']; if (is_callable($obj)) { @@ -159,14 +159,13 @@ class ModuleLoader if (empty($setupInformation['configuration'])) { return 'notFound'; } - if ( - $setupInformation['configuration']['shy'] + $finalModuleConfiguration = $setupInformation['configuration']; + if (!empty($finalModuleConfiguration['shy']) || !$this->checkModAccess($name, $setupInformation['configuration']) || !$this->checkModWorkspace($name, $setupInformation['configuration']) ) { return false; } - $finalModuleConfiguration = $setupInformation['configuration']; $finalModuleConfiguration['name'] = $name; // Language processing. This will add module labels and image reference to the internal ->moduleLabels array of the LANG object. $this->addLabelsForModule($name, ($finalModuleConfiguration['labels'] ?? $setupInformation['labels'])); @@ -193,9 +192,12 @@ class ModuleLoader } // check if there is a navigation component (like the pagetree) - if (is_array($this->navigationComponents[$name])) { + if (is_array($this->navigationComponents[$name] ?? false)) { $finalModuleConfiguration['navigationComponentId'] = $this->navigationComponents[$name]['componentId']; - } elseif ($mainModule && is_array($this->navigationComponents[$mainModule]) && $setupInformation['configuration']['inheritNavigationComponentFromMainModule'] !== false) { + } elseif ($mainModule + && is_array($this->navigationComponents[$mainModule] ?? false) + && $setupInformation['configuration']['inheritNavigationComponentFromMainModule'] !== false) { + // navigation component can be overridden by the main module component $finalModuleConfiguration['navigationComponentId'] = $this->navigationComponents[$mainModule]['componentId']; } diff --git a/typo3/sysext/backend/Classes/Template/ModuleTemplate.php b/typo3/sysext/backend/Classes/Template/ModuleTemplate.php index ffda419c37255efbb9de13ef990369c68b069fdd..6d1e5edbacb9f732fd1b9272ceb7d9ca9bb0393c 100644 --- a/typo3/sysext/backend/Classes/Template/ModuleTemplate.php +++ b/typo3/sysext/backend/Classes/Template/ModuleTemplate.php @@ -270,10 +270,10 @@ class ModuleTemplate */ protected function loadStylesheets() { - if ($GLOBALS['TBE_STYLES']['stylesheet']) { + if (!empty($GLOBALS['TBE_STYLES']['stylesheet'])) { $this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheet']); } - if ($GLOBALS['TBE_STYLES']['stylesheet2']) { + if (!empty($GLOBALS['TBE_STYLES']['stylesheet2'])) { $this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheet2']); } } diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php index 161fe78e6811098a041d2758a3598c4b1bcdc381..6b1f3b4f51a23cc0e0a6010e1bce3fccf400dd0c 100644 --- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php +++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php @@ -362,7 +362,7 @@ class BackendUtility $output = []; $pid = $uid; $ident = $pid . '-' . $clause . '-' . $workspaceOL . ($additionalFields ? '-' . implode(',', $additionalFields) : ''); - if (is_array($BEgetRootLine_cache[$ident])) { + if (is_array($BEgetRootLine_cache[$ident] ?? false)) { $output = $BEgetRootLine_cache[$ident]; } else { $loopCheck = 100; @@ -378,7 +378,20 @@ class BackendUtility } } if ($uid == 0) { - $theRowArray[] = ['uid' => 0, 'title' => '']; + $theRowArray[] = [ + 'uid' => 0, + 'pid' => null, + 'title' => '', + 'doktype' => null, + 'tsconfig_includes' => null, + 'TSconfig' => null, + 'is_siteroot' => null, + 't3ver_oid' => null, + 't3ver_wsid' => null, + 't3ver_state' => null, + 't3ver_stage' => null, + 'backend_layout_next_level' => null + ]; } $c = count($theRowArray); foreach ($theRowArray as $val) { @@ -422,7 +435,7 @@ class BackendUtility { static $getPageForRootline_cache = []; $ident = $uid . '-' . $clause . '-' . $workspaceOL; - if (is_array($getPageForRootline_cache[$ident])) { + if (is_array($getPageForRootline_cache[$ident]) ?? false) { $row = $getPageForRootline_cache[$ident]; } else { $queryBuilder = static::getQueryBuilderForTable('pages'); @@ -846,7 +859,7 @@ class BackendUtility } $cacheHash = $res['hash']; // Get User TSconfig overlay - $userTSconfig = static::getBackendUserAuthentication()->userTS['page.']; + $userTSconfig = static::getBackendUserAuthentication()->userTS['page.'] ?? null; if (is_array($userTSconfig)) { ArrayUtility::mergeRecursiveWithOverrule($tsConfig, $userTSconfig); $cacheHash .= '_user' . static::getBackendUserAuthentication()->user['uid']; @@ -1587,10 +1600,7 @@ class BackendUtility public static function getLabelFromItemlist($table, $col, $key) { // Check, if there is an "items" array: - if (is_array($GLOBALS['TCA'][$table]) - && is_array($GLOBALS['TCA'][$table]['columns'][$col]) - && is_array($GLOBALS['TCA'][$table]['columns'][$col]['config']['items']) - ) { + if (is_array($GLOBALS['TCA'][$table]['columns'][$col]['config']['items'] ?? false)) { // Traverse the items-array... foreach ($GLOBALS['TCA'][$table]['columns'][$col]['config']['items'] as $v) { // ... and return the first found label where the value was equal to $key @@ -1722,7 +1732,7 @@ class BackendUtility $recordTitle = ''; if (is_array($GLOBALS['TCA'][$table])) { // If configured, call userFunc - if ($GLOBALS['TCA'][$table]['ctrl']['label_userFunc']) { + if (!empty($GLOBALS['TCA'][$table]['ctrl']['label_userFunc'])) { $params['table'] = $table; $params['row'] = $row; $params['title'] = ''; @@ -1744,8 +1754,8 @@ class BackendUtility $row['uid'], $forceResult ); - if ($GLOBALS['TCA'][$table]['ctrl']['label_alt'] - && ($GLOBALS['TCA'][$table]['ctrl']['label_alt_force'] || (string)$recordTitle === '') + if (!empty($GLOBALS['TCA'][$table]['ctrl']['label_alt']) + && (!empty($GLOBALS['TCA'][$table]['ctrl']['label_alt_force']) || (string)$recordTitle === '') ) { $altFields = GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['label_alt'], true); $tA = []; @@ -1879,7 +1889,7 @@ class BackendUtility break; case 'inline': case 'select': - if ($theColConf['MM']) { + if (!empty($theColConf['MM'])) { if ($uid) { // Display the title of MM related records in lists if ($noRecordLookup) { @@ -1955,7 +1965,7 @@ class BackendUtility } } $l = self::getLabelsFromItemsList($table, $col, $value, $columnTsConfig); - if ($theColConf['foreign_table'] && !$l && $GLOBALS['TCA'][$theColConf['foreign_table']]) { + if (!empty($theColConf['foreign_table']) && !$l && !empty($GLOBALS['TCA'][$theColConf['foreign_table']])) { if ($noRecordLookup) { $l = $value; } else { @@ -2206,7 +2216,7 @@ class BackendUtility } } // If this field is a password field, then hide the password by changing it to a random number of asterisk (*) - if (stristr($theColConf['eval'], 'password')) { + if (!empty($theColConf['eval']) && stristr($theColConf['eval'], 'password')) { $l = ''; $randomNumber = rand(5, 12); for ($i = 0; $i < $randomNumber; $i++) { diff --git a/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php b/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php index 37ce4898fc46792112642f7d3bde9d68c28cd594..062807dd86a0b30070b58002204f2ef60d66071d 100644 --- a/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php +++ b/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php @@ -377,7 +377,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface $this->newSessionID = false; // $id is set to ses_id if cookie is present. Else set to FALSE, which will start a new session $id = $this->getCookie($this->name); - $this->svConfig = $GLOBALS['TYPO3_CONF_VARS']['SVCONF']['auth']; + $this->svConfig = $GLOBALS['TYPO3_CONF_VARS']['SVCONF']['auth'] ?? []; // If fallback to get mode.... if (!$id && $this->getFallBack && $this->get_name) { diff --git a/typo3/sysext/core/Classes/Log/LogManager.php b/typo3/sysext/core/Classes/Log/LogManager.php index 4679e4265c864b03f5d337c478b86c0712d08205..60f12155e1b57d365fe89bb90e8f161858befb12 100644 --- a/typo3/sysext/core/Classes/Log/LogManager.php +++ b/typo3/sysext/core/Classes/Log/LogManager.php @@ -179,7 +179,7 @@ class LogManager implements \TYPO3\CMS\Core\SingletonInterface, LogManagerInterf // for these keys, for example "writerConfiguration" $configurationKey = $configurationType . 'Configuration'; $configuration = $GLOBALS['TYPO3_CONF_VARS']['LOG']; - $result = $configuration[$configurationKey] ?: []; + $result = $configuration[$configurationKey] ?? []; // Walk from general to special (t3lib, t3lib.db, t3lib.db.foo) // and search for the most specific configuration foreach ($explodedName as $partOfClassName) { diff --git a/typo3/sysext/core/Classes/Session/Backend/DatabaseSessionBackend.php b/typo3/sysext/core/Classes/Session/Backend/DatabaseSessionBackend.php index ca733092c6a4786875a79fac4d05249faa1e0b1c..2917ef918f65ff4b364bc3f76268916a51502f81 100644 --- a/typo3/sysext/core/Classes/Session/Backend/DatabaseSessionBackend.php +++ b/typo3/sysext/core/Classes/Session/Backend/DatabaseSessionBackend.php @@ -51,7 +51,7 @@ class DatabaseSessionBackend implements SessionBackendInterface */ public function initialize(string $identifier, array $configuration) { - $this->hasAnonymousSessions = (bool)$configuration['has_anonymous']; + $this->hasAnonymousSessions = (bool)($configuration['has_anonymous'] ?? false); $this->configuration = $configuration; } diff --git a/typo3/sysext/core/Classes/TypoScript/TemplateService.php b/typo3/sysext/core/Classes/TypoScript/TemplateService.php index 2989a73ebc3d023ff356a28c115a890e636130dd..3f330b6c979b3986960747bb0751d9d816c0e2e9 100644 --- a/typo3/sysext/core/Classes/TypoScript/TemplateService.php +++ b/typo3/sysext/core/Classes/TypoScript/TemplateService.php @@ -947,20 +947,27 @@ class TemplateService // @todo Change to use new API foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $extKey => $files) { - if ((is_array($files) || $files instanceof \ArrayAccess) && ($files['ext_typoscript_constants.txt'] || $files['ext_typoscript_constants.typoscript'] || $files['ext_typoscript_setup.txt'] || $files['ext_typoscript_setup.typoscript'])) { + if ((is_array($files) || $files instanceof \ArrayAccess) + && ( + !empty($files['ext_typoscript_constants.txt']) + || !empty($files['ext_typoscript_constants.typoscript']) + || !empty($files['ext_typoscript_setup.txt']) + || !empty($files['ext_typoscript_setup.typoscript']) + ) + ) { $mExtKey = str_replace('_', '', $extKey); $constants = ''; $config = ''; - if ($files['ext_typoscript_constants.typoscript']) { + if (!empty($files['ext_typoscript_constants.typoscript'])) { $constants = @file_get_contents($files['ext_typoscript_constants.typoscript']); - } elseif ($files['ext_typoscript_constants.txt']) { + } elseif (!empty($files['ext_typoscript_constants.txt'])) { $constants = @file_get_contents($files['ext_typoscript_constants.txt']); } - if ($files['ext_typoscript_setup.typoscript']) { + if (!empty($files['ext_typoscript_setup.typoscript'])) { $config = @file_get_contents($files['ext_typoscript_setup.typoscript']); - } elseif ($files['ext_typoscript_setup.txt']) { + } elseif (!empty($files['ext_typoscript_setup.txt'])) { $config = @file_get_contents($files['ext_typoscript_setup.txt']); } diff --git a/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php b/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php index 49ea69eabf660ace7a0b2d70b55e57f444cc84b5..f41e83f8e6629ac3943d174fdbdec341a9482944 100644 --- a/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php +++ b/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php @@ -294,7 +294,7 @@ class ExtensionManagementUtility $fieldExists = false; $newPosition = ''; - if (is_array($GLOBALS['TCA'][$table]['palettes'])) { + if (is_array($GLOBALS['TCA'][$table]['palettes'] ?? false)) { // Get the palette names used in current showitem $paletteCount = preg_match_all('/(?:^|,) # Line start or a comma (?: @@ -305,6 +305,9 @@ class ExtensionManagementUtility $paletteNames = array_filter(array_merge($paletteMatches[1], $paletteMatches[2])); if (!empty($paletteNames)) { foreach ($paletteNames as $paletteName) { + if (!isset($GLOBALS['TCA'][$table]['palettes'][$paletteName])) { + continue; + } $palette = $GLOBALS['TCA'][$table]['palettes'][$paletteName]; switch ($positionIdentifier) { case 'after': @@ -901,9 +904,9 @@ class ExtensionManagementUtility $options = [ 'module' => true, 'moduleName' => $fullModuleSignature, - 'access' => $moduleConfiguration['access'] ?: 'user,group' + 'access' => !empty($moduleConfiguration['access']) ? $moduleConfiguration['access'] : 'user,group' ]; - if ($moduleConfiguration['routeTarget']) { + if (!empty($moduleConfiguration['routeTarget'])) { $options['target'] = $moduleConfiguration['routeTarget']; } @@ -979,10 +982,10 @@ class ExtensionManagementUtility if (empty($key)) { throw new \RuntimeException('No extension key set in addLLrefForTCAdescr(). Provide it as third parameter', 1507321596); } - if (!is_array($GLOBALS['TCA_DESCR'][$key])) { + if (!is_array($GLOBALS['TCA_DESCR'][$key] ?? false)) { $GLOBALS['TCA_DESCR'][$key] = []; } - if (!is_array($GLOBALS['TCA_DESCR'][$key]['refs'])) { + if (!is_array($GLOBALS['TCA_DESCR'][$key]['refs'] ?? false)) { $GLOBALS['TCA_DESCR'][$key]['refs'] = []; } $GLOBALS['TCA_DESCR'][$key]['refs'][] = $file; diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php index ac6669255f07cad45f3e3b316591329130167356..71cd8d455a8066683eae333339635edc153eb70d 100644 --- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php +++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php @@ -1641,7 +1641,7 @@ class GeneralUtility // Closing tag. $tagName = $tagName[0] === 'n' && MathUtility::canBeInterpretedAsInteger($testNtag) ? (int)$testNtag : $tagName; // Test for alternative index value: - if ((string)$val['attributes']['index'] !== '') { + if ((string)($val['attributes']['index'] ?? '') !== '') { $tagName = $val['attributes']['index']; } // Setting tag-values, manage stack: diff --git a/typo3/sysext/extbase/Classes/Utility/ExtensionUtility.php b/typo3/sysext/extbase/Classes/Utility/ExtensionUtility.php index 5ecadfd807a4a1dbad3ffef12d5efafc287e1717..85ab703c90cf2871f63d684a0c381d34842fcb51 100644 --- a/typo3/sysext/extbase/Classes/Utility/ExtensionUtility.php +++ b/typo3/sysext/extbase/Classes/Utility/ExtensionUtility.php @@ -59,7 +59,7 @@ class ExtensionUtility $extensionName = str_replace(' ', '', ucwords(str_replace('_', ' ', $extensionName))); $pluginSignature = strtolower($extensionName . '_' . $pluginName); - if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['plugins'][$pluginName])) { + if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['plugins'][$pluginName] ?? false)) { $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['plugins'][$pluginName] = []; } foreach ($controllerActions as $controllerName => $actionsList) { diff --git a/typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php b/typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php index 404dd911bbe7659232275b516342615f72fe82c3..badf8a6a28834db6d40657fdbd74a0e0faba926a 100644 --- a/typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php +++ b/typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php @@ -220,7 +220,7 @@ class LocalizationUtility { $configurationManager = static::getConfigurationManager(); $frameworkConfiguration = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, $extensionName); - if (!is_array($frameworkConfiguration['_LOCAL_LANG'])) { + if (!is_array($frameworkConfiguration['_LOCAL_LANG'] ?? false)) { return; } self::$LOCAL_LANG_UNSET[$languageFilePath] = []; diff --git a/typo3/sysext/t3editor/Configuration/TCA/Overrides/tt_content.php b/typo3/sysext/t3editor/Configuration/TCA/Overrides/tt_content.php index 12382874376ee3fa4cc11431ad98a558e3603bca..263f0dad1a34d92f0737d4a12480f4535cfedf17 100644 --- a/typo3/sysext/t3editor/Configuration/TCA/Overrides/tt_content.php +++ b/typo3/sysext/t3editor/Configuration/TCA/Overrides/tt_content.php @@ -3,13 +3,13 @@ defined('TYPO3_MODE') or die(); // Activate t3editor for tt_content type HTML if this type exists if (is_array($GLOBALS['TCA']['tt_content']['types']['html'])) { - if (!is_array($GLOBALS['TCA']['tt_content']['types']['html']['columnsOverrides'])) { + if (!isset($GLOBALS['TCA']['tt_content']['types']['html']['columnsOverrides'])) { $GLOBALS['TCA']['tt_content']['types']['html']['columnsOverrides'] = []; } - if (!is_array($GLOBALS['TCA']['tt_content']['types']['html']['columnsOverrides']['bodytext'])) { + if (!isset($GLOBALS['TCA']['tt_content']['types']['html']['columnsOverrides']['bodytext'])) { $GLOBALS['TCA']['tt_content']['types']['html']['columnsOverrides']['bodytext'] = []; } - if (!is_array($GLOBALS['TCA']['tt_content']['types']['html']['columnsOverrides']['bodytext']['config'])) { + if (!isset($GLOBALS['TCA']['tt_content']['types']['html']['columnsOverrides']['bodytext']['config'])) { $GLOBALS['TCA']['tt_content']['types']['html']['columnsOverrides']['bodytext']['config'] = []; } $GLOBALS['TCA']['tt_content']['types']['html']['columnsOverrides']['bodytext']['config']['renderType'] = 't3editor';