diff --git a/components/ILIAS/Test/src/Participants/ParticipantTableActions.php b/components/ILIAS/Test/src/Participants/ParticipantTableActions.php index d639d59b790b..c1dbb4695e4d 100644 --- a/components/ILIAS/Test/src/Participants/ParticipantTableActions.php +++ b/components/ILIAS/Test/src/Participants/ParticipantTableActions.php @@ -202,16 +202,20 @@ protected function resolveSelectedParticipants(TableAction $action, array|string if ($selected_participants === 'ALL_OBJECTS') { return array_filter( iterator_to_array($this->repository->getParticipants($this->test_obj->getTestId())), - fn(Participant $participant) => $action->allowActionForRecord($participant) + static fn(Participant $participant): bool => $action->allowActionForRecord($participant) ); } + if (!is_array($selected_participants)) { + return []; + } + return array_filter( array_map( - fn(int $user_id) => $this->repository->getParticipantByUserId($this->test_obj->getTestId(), $user_id), + fn(int $user_id): ?Participant => $this->repository->getParticipantByUserId($this->test_obj->getTestId(), $user_id), $selected_participants ), - fn(Participant $participant) => $action->allowActionForRecord($participant) + static fn(?Participant $participant): bool => $participant instanceof Participant && $action->allowActionForRecord($participant) ); } }