From 070e0e2a7f0fd85784970a1deae8f2a1af204c55 Mon Sep 17 00:00:00 2001 From: Julian Hofmann Date: Tue, 23 Dec 2025 11:44:00 +0100 Subject: [PATCH 1/2] [BUGFIX] Correct return type of getPageRowFromPageIdentifier() The case where fetchAssociative() returns FALSE was handled incorrectly. Instead of an empty array, a single-element array was returned. This could lead to errors or exceptions in further processing of the return value. Now either the pages record is returned or an *empty* array. --- Classes/Domain/Service/PermissionTrait.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Classes/Domain/Service/PermissionTrait.php b/Classes/Domain/Service/PermissionTrait.php index fdf328c0..f1d9457f 100644 --- a/Classes/Domain/Service/PermissionTrait.php +++ b/Classes/Domain/Service/PermissionTrait.php @@ -110,13 +110,13 @@ protected function getPageIdentifierFromRecord(int $identifier, string $table): /** * @param int $identifier - * @return array|int + * @return array * @throws ExceptionDbal */ protected function getPageRowFromPageIdentifier(int $identifier): array { $queryBuilder = DatabaseUtility::getQueryBuilderForTable('pages'); - return (array)$queryBuilder + $row = $queryBuilder ->select('*') ->from('pages') ->where( @@ -125,5 +125,6 @@ protected function getPageRowFromPageIdentifier(int $identifier): array ->setMaxResults(1) ->executeQuery() ->fetchAssociative(); + return $row ?: []; } } From 7194e0737d2aae0d2e02d8d7f309a2afde5f7ab7 Mon Sep 17 00:00:00 2001 From: Julian Hofmann Date: Tue, 23 Dec 2025 12:00:48 +0100 Subject: [PATCH 2/2] [BUGFIX] Do not pass empty page-record to authentication check --- Classes/Domain/Service/PermissionTrait.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Classes/Domain/Service/PermissionTrait.php b/Classes/Domain/Service/PermissionTrait.php index f1d9457f..7e5b975b 100644 --- a/Classes/Domain/Service/PermissionTrait.php +++ b/Classes/Domain/Service/PermissionTrait.php @@ -72,7 +72,11 @@ private function isAuthenticatedForRecord(int $identifier, string $table): bool $pageIdentifier = $this->getPageIdentifierFromRecord($identifier, $table); if ($pageIdentifier > 0) { - return $this->isAuthenticatedForPageRow($this->getPageRowFromPageIdentifier($pageIdentifier)); + $pageRecord = $this->getPageRowFromPageIdentifier($pageIdentifier); + if ($pageRecord === []) { + return false; + } + return $this->isAuthenticatedForPageRow($pageRecord); } return false; }