diff --git a/Classes/Controller/AbstractController.php b/Classes/Controller/AbstractController.php index 6f9159d48..b53ff4007 100644 --- a/Classes/Controller/AbstractController.php +++ b/Classes/Controller/AbstractController.php @@ -129,6 +129,9 @@ protected function initialize(): void */ protected function loadDocument(int $documentId = 0): void { + // Sanitize FlexForm settings to avoid later casting. + $this->sanitizeSettings(); + // Get document ID from request data if not passed as parameter. if ($documentId === 0 && !empty($this->requestData['id'])) { $documentId = $this->requestData['id']; @@ -317,7 +320,7 @@ protected function sanitizeSettings(): void */ protected function setDefaultIntSetting(string $setting, int $value): void { - if (empty($this->settings[$setting])) { + if (!array_key_exists($setting, $this->settings) || empty($this->settings[$setting])) { $this->settings[$setting] = $value; $this->logger->warning('Setting "' . $setting . '" not set, using default value "' . $value . '". Probably FlexForm for controller "' . get_class($this) . '" is not read.'); } else {