From 3235d33e724127d3366fe1105216b4679f090467 Mon Sep 17 00:00:00 2001 From: Marcus Schwemer Date: Wed, 9 Oct 2024 18:33:09 +0200 Subject: [PATCH] [BUGFIX] Force type int for pid value Related: in2code-de/powermail#953 --- .project/tests/phpstan-baseline.neon | 5 ----- Classes/EventListener/FlexFormParsingModifyEventListener.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.project/tests/phpstan-baseline.neon b/.project/tests/phpstan-baseline.neon index bcb8901b9..906357462 100644 --- a/.project/tests/phpstan-baseline.neon +++ b/.project/tests/phpstan-baseline.neon @@ -2645,11 +2645,6 @@ parameters: count: 1 path: ../../Classes/EventListener/FlexFormParsingModifyEventListener.php - - - message: "#^Parameter \\#1 \\$uid of static method In2code\\\\Powermail\\\\Utility\\\\DatabaseUtility\\:\\:getPidForRecord\\(\\) expects int, int\\|string given\\.$#" - count: 1 - path: ../../Classes/EventListener/FlexFormParsingModifyEventListener.php - - message: "#^Property In2code\\\\Powermail\\\\EventListener\\\\FlexFormParsingModifyEventListener\\:\\:\\$allowedSheets type has no value type specified in iterable type array\\.$#" count: 1 diff --git a/Classes/EventListener/FlexFormParsingModifyEventListener.php b/Classes/EventListener/FlexFormParsingModifyEventListener.php index 9776304a6..29021661a 100644 --- a/Classes/EventListener/FlexFormParsingModifyEventListener.php +++ b/Classes/EventListener/FlexFormParsingModifyEventListener.php @@ -81,7 +81,7 @@ private function getPidForCurrentRecord(): int $request = $this->getRequest(); if ($request) { $queryParams = $request->getQueryParams(); - $uid = array_keys($queryParams['edit']['tt_content'] ?? [])[0] ?? 0; + $uid = (int)(array_keys($queryParams['edit']['tt_content'] ?? [])[0] ?? 0); } return DatabaseUtility::getPidForRecord($uid, 'tt_content'); }