From 5d276d1f98641d1df1d6380d2104147c9c12b822 Mon Sep 17 00:00:00 2001 From: Silberengel Date: Wed, 27 May 2026 18:36:09 +0200 Subject: [PATCH] fix slug bug --- src/Service/MagazineContentService.php | 9 ++++++--- src/Service/TopicIndexService.php | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Service/MagazineContentService.php b/src/Service/MagazineContentService.php index 49a4e68..7887187 100644 --- a/src/Service/MagazineContentService.php +++ b/src/Service/MagazineContentService.php @@ -702,6 +702,7 @@ final class MagazineContentService */ public function collectFeaturedArticleSlugsForHome(array $categoryATags): array { + $seen = []; $out = []; foreach ($categoryATags as $row) { $coord = $row[1]; @@ -711,14 +712,16 @@ final class MagazineContentService foreach ($this->buildFeaturedWallBlocksForCategoryTree($coord) as $b) { foreach ($b['cards'] as $card) { $s = \trim((string) $card->getSlug()); - if ($s !== '') { - $out[$s] = true; + if ($s !== '' && !isset($seen[$s])) { + // Use a list, not slug-keyed map: PHP casts numeric-string keys to int. + $seen[$s] = true; + $out[] = $s; } } } } - return array_keys($out); + return $out; } /** diff --git a/src/Service/TopicIndexService.php b/src/Service/TopicIndexService.php index 37d5164..fcddeac 100644 --- a/src/Service/TopicIndexService.php +++ b/src/Service/TopicIndexService.php @@ -32,7 +32,7 @@ final class TopicIndexService ); $featured = []; foreach ($slugs as $s) { - $s = \strtolower(\trim($s)); + $s = \strtolower(\trim((string) $s)); if ($s !== '') { $featured[$s] = true; }