Commit 4a74f00e authored by Pawel Cieslik's avatar Pawel Cieslik Committed by Christian Kuhn
Browse files

[TASK] E_NOTICE reduction

Reduce number of E_NOTICE thrown by TYPO3

Resolves: #70584
Releases: master
Change-Id: I46fb54e51b24af5721efaa9507b32b86f38fc325
Reviewed-on: https://review.typo3.org/54884

Reviewed-by: Jan Helke's avatarJan Helke <typo3@helke.de>
Tested-by: Jan Helke's avatarJan Helke <typo3@helke.de>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent a89781be
......@@ -109,16 +109,20 @@ class AboutController
*/
protected function getSubModuleData(ModuleLoader $loadedModules, $moduleName): array
{
if (empty($loadedModules->modules[$moduleName]['sub'])) {
return [];
}
$subModulesData = [];
foreach ($loadedModules->modules[$moduleName]['sub'] as $subModuleName => $subModuleInfo) {
$moduleLabels = $loadedModules->getLabelsForModule($moduleName . '_' . $subModuleName);
$subModuleData = [];
$subModuleData['name'] = $subModuleName;
$subModuleData['icon'] = $subModuleInfo['icon'];
$subModuleData['iconIdentifier'] = $subModuleInfo['iconIdentifier'];
$subModuleData['label'] = $moduleLabels['title'];
$subModuleData['shortDescription'] = $moduleLabels['shortdescription'];
$subModuleData['longDescription'] = $moduleLabels['description'];
$subModuleData['icon'] = $subModuleInfo['icon'] ?? null;
$subModuleData['iconIdentifier'] = $subModuleInfo['iconIdentifier'] ?? null;
$subModuleData['label'] = $moduleLabels['title'] ?? null;
$subModuleData['shortDescription'] = $moduleLabels['shortdescription'] ?? null;
$subModuleData['longDescription'] = $moduleLabels['description'] ?? null;
$subModulesData[] = $subModuleData;
}
return $subModulesData;
......
......@@ -378,7 +378,7 @@ class PageLayoutController
}
}
// Setting alternative default label:
if (($this->modSharedTSconfig['properties']['defaultLanguageLabel'] || $this->modTSconfig['properties']['defaultLanguageLabel']) && isset($this->MOD_MENU['language'][0])) {
if ((!empty($this->modSharedTSconfig['properties']['defaultLanguageLabel']) || !empty($this->modTSconfig['properties']['defaultLanguageLabel'])) && isset($this->MOD_MENU['language'][0])) {
$this->MOD_MENU['language'][0] = $this->modTSconfig['properties']['defaultLanguageLabel'] ? $this->modTSconfig['properties']['defaultLanguageLabel'] : $this->modSharedTSconfig['properties']['defaultLanguageLabel'];
}
// Initialize the avaiable actions
......@@ -386,7 +386,9 @@ class PageLayoutController
// Clean up settings
$this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), $this->moduleName);
// For all elements to be shown in draft workspaces & to also show hidden elements by default if user hasn't disabled the option
if ($this->getBackendUser()->workspace != 0 || $this->MOD_SETTINGS['tt_content_showHidden'] !== '0') {
if ($this->getBackendUser()->workspace != 0 ||
isset($this->MOD_SETTINGS['tt_content_showHidden']) && $this->MOD_SETTINGS['tt_content_showHidden'] !== '0'
) {
$this->MOD_SETTINGS['tt_content_showHidden'] = 1;
}
// Make action menu from available actions
......
......@@ -568,7 +568,7 @@ abstract class AbstractConditionMatcher
$vars = explode('|', $var);
$c = count($vars);
$k = trim($vars[0]);
$theVar = isset($source) ? $source[$k] : $GLOBALS[$k];
$theVar = isset($source) ? ($source[$k] ?? null) : ($GLOBALS[$k] ?? null);
for ($a = 1; $a < $c; $a++) {
if (!isset($theVar)) {
break;
......
......@@ -152,7 +152,7 @@ class FileWriter extends AbstractWriter
*/
protected function openLogFile()
{
if (isset(self::$logFileHandles[$this->logFile]) && is_resource(self::$logFileHandles[$this->logFile])) {
if (isset(self::$logFileHandles[$this->logFile]) && is_resource(self::$logFileHandles[$this->logFile] ?? false)) {
return;
}
......
......@@ -322,7 +322,7 @@ class TypoScriptParser
// If multiline is enabled. Escape by ')'
if ($this->multiLineEnabled) {
// Multiline ends...
if ($line[0] === ')') {
if (!empty($line[0]) && $line[0] === ')') {
if ($this->syntaxHighLight) {
$this->regHighLight('operator', $lineP, strlen($line) - 1);
}
......
......@@ -1062,7 +1062,7 @@ class ExtensionManagementUtility
// Change the priority (and other values) from $GLOBALS['TYPO3_CONF_VARS']
// $GLOBALS['TYPO3_CONF_VARS']['T3_SERVICES'][$serviceType][$serviceKey]['priority']
// even the activation is possible (a unix service might be possible on windows for some reasons)
if (is_array($GLOBALS['TYPO3_CONF_VARS']['T3_SERVICES'][$serviceType][$serviceKey])) {
if (is_array($GLOBALS['TYPO3_CONF_VARS']['T3_SERVICES'][$serviceType][$serviceKey] ?? false)) {
// No check is done here - there might be configuration values only the service type knows about, so
// we pass everything
$GLOBALS['T3_SERVICES'][$serviceType][$serviceKey] = array_merge($GLOBALS['T3_SERVICES'][$serviceType][$serviceKey], $GLOBALS['TYPO3_CONF_VARS']['T3_SERVICES'][$serviceType][$serviceKey]);
......@@ -1463,9 +1463,15 @@ tt_content.' . $key . $suffix . ' {
}
$GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_' . $type . '.']['defaultContentRendering'] .= $content;
} else {
if (!isset($GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_' . $type . '.'][$afterStaticUid])) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_' . $type . '.'][$afterStaticUid] = '';
}
$GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_' . $type . '.'][$afterStaticUid] .= $content;
}
} else {
if (!isset($GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_' . $type])) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_' . $type] = '';
}
$GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_' . $type] .= $content;
}
}
......
......@@ -111,7 +111,7 @@ class Bootstrap implements \TYPO3\CMS\Extbase\Core\BootstrapInterface
public function configureObjectManager()
{
$frameworkSetup = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
if (!is_array($frameworkSetup['objects'])) {
if (!isset($frameworkSetup['objects']) || !is_array($frameworkSetup['objects'])) {
return;
}
$objectContainer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\Container::class);
......
......@@ -211,7 +211,9 @@ tt_content.' . $pluginSignature . ' {
*/
public static function registerTypeConverter($typeConverterClassName)
{
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['typeConverters'])) {
if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['typeConverters']) ||
!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['typeConverters'])
) {
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['typeConverters'] = [];
}
if (!in_array($typeConverterClassName, $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['typeConverters'])) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment