From a0107be2af513730fac9d1f83a57a92bd4d4f51c Mon Sep 17 00:00:00 2001 From: RealKinetix Date: Wed, 14 Jul 2021 13:51:30 -0700 Subject: [PATCH] Negative numbers in following is a thing too Check & sanitize 'following' as well, as per: https://mastodon.social/@BLUW --- src/Model/APContact.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Model/APContact.php b/src/Model/APContact.php index 64f45a8451..1ae34a40a8 100644 --- a/src/Model/APContact.php +++ b/src/Model/APContact.php @@ -266,6 +266,11 @@ class APContact if (!empty($apcontact['following'])) { $following = ActivityPub::fetchContent($apcontact['following']); if (!empty($following['totalItems'])) { + // Mastodon seriously allows for this condition? + // Jul 14 2021 - See https://mastodon.social/@BLUW for a negative following count + if ($following['totalItems'] < 0) { + $following['totalItems'] = 0; + } $apcontact['following_count'] = $following['totalItems']; } }