Skip to content

Commit

Permalink
[BUGFIX] Call sanitizeSettings function in loadDocument of `Abstr…
Browse files Browse the repository at this point in the history
…actController` (#1334)

Co-authored-by: Sebastian Meyer <[email protected]>
  • Loading branch information
beatrycze-volk and sebastian-meyer committed Sep 20, 2024
1 parent 8ba71cf commit 0377a5e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Classes/Controller/AbstractController.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,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'];
Expand Down Expand Up @@ -313,7 +316,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 {
Expand Down

0 comments on commit 0377a5e

Please sign in to comment.