From f5d8604e596f8f50f5e6fa281827c196cbc8148f Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 4 May 2023 23:32:29 -0400 Subject: [PATCH] [twitter] Return null in the probe_detect hook result key on unsuccessful probe - Add authoritative probe result setting --- twitter/twitter.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/twitter/twitter.php b/twitter/twitter.php index c55489a0..aaa378d1 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -526,7 +526,12 @@ function twitter_probe_detect(array &$hookData) $user = twitter_fetchuser($nick); if ($user) { - $hookData['result'] = twitter_user_to_contact($user); + $hookData['result'] = twitter_user_to_contact($user) ?: null; + } + + // Authoritative probe should set the result even if the probe was unsuccessful + if ($hookData['network'] == Protocol::TWITTER && empty($hookData['result'])) { + $hookData['result'] = []; } }