Skip to content

Commit

Permalink
[BUGFIX] Avoid errors because of warnings/notices (#1008)
Browse files Browse the repository at this point in the history
Updated a project and got some warnings
  • Loading branch information
georgringer authored Jun 7, 2024
1 parent 39bf737 commit e929887
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Classes/Update/PowermailPluginUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function performMigration(string $list_type): bool
$flexForm = $this->flexFormService->convertFlexFormContentToArray($record['pi_flexform']);

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

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

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

protected function getAllowedSettingsFromFlexForm(string $listType): array
{
$flexFormFile = $GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds']['*,' . $listType];
$flexFormFile = $GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds']['*,' . $listType] ?? null;
if (!$flexFormFile) {
return [];
}
$flexFormContent = file_get_contents(GeneralUtility::getFileAbsFileName(substr(trim($flexFormFile), 5)));
$flexFormData = GeneralUtility::xml2array($flexFormContent);

Expand Down

0 comments on commit e929887

Please sign in to comment.