Skip to content

Commit

Permalink
[BUGFIX] Handle lookup of properties of non-existing page
Browse files Browse the repository at this point in the history
Resolves: #874
  • Loading branch information
eliashaeussler authored and mschwemer committed Jul 8, 2024
1 parent 0be104a commit b6e6865
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Classes/Domain/Repository/PageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public function getPageNameFromUid(int $uid): string
public function getPropertiesFromUid(int $uid): array
{
$connection = DatabaseUtility::getConnectionForTable('pages');
return $connection->executeQuery('select * from pages where uid=' . (int)$uid . ' limit 1')->fetchAssociative();
$properties = $connection->executeQuery('select * from pages where uid=' . (int)$uid . ' limit 1')->fetchAssociative();
return $properties ?: [];
}

/**
Expand Down
4 changes: 3 additions & 1 deletion Classes/Tca/FormSelectorUserFunc.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ protected function hasUserAccessToPage(int $pageIdentifier): bool
{
if (!$this->hasFullAccess()) {
$properties = $this->pageRepository->getPropertiesFromUid($pageIdentifier);
return BackendUtility::getBackendUserAuthentication()->doesUserHaveAccess($properties, 1);
if ($properties !== []) {
return BackendUtility::getBackendUserAuthentication()->doesUserHaveAccess($properties, 1);
}
}
return true;
}
Expand Down

0 comments on commit b6e6865

Please sign in to comment.