Skip to content

Commit

Permalink
Call sanitizeSettings function in loadDocument of `AbstractContro…
Browse files Browse the repository at this point in the history
…ller`
  • Loading branch information
beatrycze-volk committed Sep 19, 2024
1 parent 55f8976 commit f861947
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 @@ -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'];
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit f861947

Please sign in to comment.