Skip to content

Commit e929887

Browse files
authored
[BUGFIX] Avoid errors because of warnings/notices (#1008)
Updated a project and got some warnings
1 parent 39bf737 commit e929887

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Classes/Update/PowermailPluginUpdater.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function performMigration(string $list_type): bool
112112
$flexForm = $this->flexFormService->convertFlexFormContentToArray($record['pi_flexform']);
113113

114114
if ($list_type === 'powermail_pi2') {
115-
$targetCType = $this->getTargetListType($flexForm['switchableControllerActions']);
115+
$targetCType = $this->getTargetListType($flexForm['switchableControllerActions'] ?? '');
116116
$allowedSettings = $this->getAllowedSettingsFromFlexForm($targetCType);
117117
foreach ($flexFormData['data'] as $sheetKey => $sheetData) {
118118
foreach ($sheetData['lDEF'] as $settingName => $setting) {
@@ -138,7 +138,7 @@ public function performMigration(string $list_type): bool
138138
}
139139

140140
// Remove flexform data which do not exist in flexform of new plugin
141-
$this->updateContentElement($record['uid'], $targetCType, $newFlexform);
141+
$this->updateContentElement($record['uid'], $targetCType, (string)$newFlexform);
142142
}
143143

144144
return true;
@@ -181,7 +181,10 @@ protected function getTargetListType(string $switchableControllerActions): strin
181181

182182
protected function getAllowedSettingsFromFlexForm(string $listType): array
183183
{
184-
$flexFormFile = $GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds']['*,' . $listType];
184+
$flexFormFile = $GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds']['*,' . $listType] ?? null;
185+
if (!$flexFormFile) {
186+
return [];
187+
}
185188
$flexFormContent = file_get_contents(GeneralUtility::getFileAbsFileName(substr(trim($flexFormFile), 5)));
186189
$flexFormData = GeneralUtility::xml2array($flexFormContent);
187190

0 commit comments

Comments
 (0)