From da9b57815fe223468fbe60630346c38da920f934 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Tue, 13 Feb 2024 18:28:06 +0100 Subject: [PATCH] fix(setup): Use MX sort result Signed-off-by: Christoph Wurst --- lib/Service/AutoConfig/MxRecord.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/Service/AutoConfig/MxRecord.php b/lib/Service/AutoConfig/MxRecord.php index 0090b14155..a1daf07768 100644 --- a/lib/Service/AutoConfig/MxRecord.php +++ b/lib/Service/AutoConfig/MxRecord.php @@ -49,15 +49,14 @@ public function query(string $host) { $sortedRecords = array_combine($mxRecords, $mxWeights); asort($sortedRecords, SORT_NUMERIC); - $mxRecords = array_filter($mxRecords, static function ($record) { + $mxRecords = array_filter(array_keys($sortedRecords), static function ($record) { return !empty($record); }); - $this->logger->debug("found " . count($mxRecords) . " MX records for host <$host>"); + $this->logger->debug("found " . count($sortedRecords) . " MX records for host <$host>"); if (empty(($mxRecords))) { return []; } - // TODO: sort by weight return $this->sanitizedRecords($mxRecords); }