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 authored Sep 20, 2024
1 parent 98ff13a commit 2e61841
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 @@ -132,6 +132,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 @@ -320,7 +323,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 2e61841

Please sign in to comment.