From 553e10892fe9f0101502936762e75982a991c69f Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Tue, 15 Feb 2022 17:43:18 +0800 Subject: [PATCH] fix PTGen render when json invalid --- nexus/PTGen/PTGen.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nexus/PTGen/PTGen.php b/nexus/PTGen/PTGen.php index 0efccd69..f9f0a85c 100644 --- a/nexus/PTGen/PTGen.php +++ b/nexus/PTGen/PTGen.php @@ -183,11 +183,12 @@ HTML; return $html; } - public function renderDetailsPageDescription($torrentId, array $torrentPtGenArr): array + public function renderDetailsPageDescription($torrentId, $torrentPtGenArr): array { $html = ''; $jsonArr = []; $update = false; + $torrentPtGenArr = (array)$torrentPtGenArr; foreach (self::$validSites as $site => $info) { if (empty($torrentPtGenArr[$site]['link'])) { continue; @@ -224,9 +225,10 @@ HTML; return ['json_arr' => $jsonArr, 'html' => $html, 'update' => $update]; } - public function renderTorrentsPageAverageRating(array $ptGenData) + public function renderTorrentsPageAverageRating($ptGenData) { $siteIdAndRating = []; + $ptGenData = (array)$ptGenData; foreach (self::$validSites as $site => $info) { $rating = $ptGenData[$site]['data']["{$site}_rating_average"] ?? ''; if (empty($rating)) { @@ -273,4 +275,4 @@ HTML; ); return $result; } -} \ No newline at end of file +}