From f4130a972465486186da7f646e13dc9574ed586b Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 19 Nov 2022 19:19:30 -0500 Subject: [PATCH] [various] Fix PHP 8 deprecation warnings --- diaspora/diaspora.php | 2 +- tumblr/tumblr.php | 3 +-- twitter/twitter.php | 6 +++--- wppost/wppost.php | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/diaspora/diaspora.php b/diaspora/diaspora.php index 1fe6fa12..79c0aba2 100644 --- a/diaspora/diaspora.php +++ b/diaspora/diaspora.php @@ -145,7 +145,7 @@ function diaspora_hook_fork(App $a, array &$b) $post = $b['data']; if ($post['deleted'] || $post['private'] || ($post['created'] !== $post['edited']) || - !strstr($post['postopts'], 'diaspora') || ($post['parent'] != $post['id'])) { + !strstr($post['postopts'] ?? '', 'diaspora') || ($post['parent'] != $post['id'])) { $b['execute'] = false; return; } diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index 281c58ac..c3a5561f 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -266,7 +266,7 @@ function tumblr_hook_fork(App $a, array &$b) $post = $b['data']; if ($post['deleted'] || $post['private'] || ($post['created'] !== $post['edited']) || - !strstr($post['postopts'], 'tumblr') || ($post['parent'] != $post['id'])) { + !strstr($post['postopts'] ?? '', 'tumblr') || ($post['parent'] != $post['id'])) { $b['execute'] = false; return; } @@ -442,4 +442,3 @@ function tumblr_send(App $a, array &$b) { } } } - diff --git a/twitter/twitter.php b/twitter/twitter.php index 54ccfa1e..80ac14a6 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -440,7 +440,7 @@ function twitter_hook_fork(App $a, array &$b) return; } - if (substr($post['app'], 0, 7) == 'Twitter') { + if (substr($post['app'] ?? '', 0, 7) == 'Twitter') { DI::logger()->info('No Twitter app'); $b['execute'] = false; return; @@ -455,7 +455,7 @@ function twitter_hook_fork(App $a, array &$b) } } else { // Comments are never exported when we don't import the twitter timeline - if (!strstr($post['postopts'], 'twitter') || ($post['parent'] != $post['id']) || $post['private']) { + if (!strstr($post['postopts'] ?? '', 'twitter') || ($post['parent'] != $post['id']) || $post['private']) { DI::logger()->info('Comments are never exported when we don\'t import the twitter timeline'); $b['execute'] = false; return; @@ -1582,7 +1582,7 @@ function twitter_auto_follow(int $uid, object $data) // We only probe on Mastodon style URL to reduce the number of unsuccessful probes twitter_add_contact($url->expanded_url, strpos($url->expanded_url, '@'), $uid); } - } + } } /** diff --git a/wppost/wppost.php b/wppost/wppost.php index aa7adf5e..be2461dd 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -107,7 +107,7 @@ function wppost_hook_fork(App $a, array &$b) $post = $b['data']; if ($post['deleted'] || $post['private'] || ($post['created'] !== $post['edited']) || - !strstr($post['postopts'], 'wppost') || ($post['parent'] != $post['id'])) { + !strstr($post['postopts'] ?? '', 'wppost') || ($post['parent'] != $post['id'])) { $b['execute'] = false; return; } -- 2.39.5