From 1740ae2104ff734edd45f6c0f1273d561cc4a69c Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 2 Feb 2022 17:58:29 +0000 Subject: more PHP 8.1 deprecated warnings --- Zotlabs/Lib/Libzot.php | 1 + include/contact_widgets.php | 4 ++++ include/conversation.php | 4 ++-- include/items.php | 4 ++-- include/text.php | 2 +- include/zid.php | 2 +- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index dbcc2af52..8f08e42d3 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1927,6 +1927,7 @@ class Libzot { dbesc($a['signature']['signer']) ); + foreach ($items as $activity) { $AS = new ActivityStreams($activity); diff --git a/include/contact_widgets.php b/include/contact_widgets.php index 875a519a5..1ae8b17c5 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -100,6 +100,10 @@ function categories_widget($baseurl,$selected = '') { \Zotlabs\Daemon\Master::Summon([ 'Cache_query', $key, base64_encode(json_encode($arr)) ]); } + if (!$content) { + return EMPTY_STR; + } + $r = unserialize($content); $terms = []; diff --git a/include/conversation.php b/include/conversation.php index 17367856c..c0238b8ae 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -558,7 +558,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa $page_writeable = ($profile_owner == local_channel()); if (!$update) { - $tab = notags(trim($_GET['tab'])); + $tab = notags(trim((string)$_GET['tab'])); if ($tab === 'posts') { // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, // because browser prefetching might change it on us. We have to deliver it with the page. @@ -974,7 +974,7 @@ function best_link_url($item) { } } if(! $best_url) { - if(strlen($item['author-link'])) + if($item['author-link']) $best_url = $item['author-link']; else $best_url = $item['url']; diff --git a/include/items.php b/include/items.php index e198ea54f..0b33d876d 100644 --- a/include/items.php +++ b/include/items.php @@ -1446,7 +1446,7 @@ function activity_sanitise($arr) { if(is_array($x)) $ret[$k] = activity_sanitise($x); else - $ret[$k] = htmlspecialchars($x, ENT_COMPAT, 'UTF-8', false); + $ret[$k] = htmlspecialchars((string)$x, ENT_COMPAT, 'UTF-8', false); } return $ret; } @@ -4438,7 +4438,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C ); } - if(strlen($arr['file'])) { + if($arr['file']) { $sql_extra .= term_query('item',$arr['files'],TERM_FILE); } diff --git a/include/text.php b/include/text.php index 2e5e728a0..29a2ab3b1 100644 --- a/include/text.php +++ b/include/text.php @@ -846,7 +846,7 @@ function activity_match($haystack,$needle) { if($needle) { foreach($needle as $n) { - if(($haystack === $n) || (strtolower(basename($n)) === strtolower(basename($haystack)))) { + if(($haystack === $n) || (strtolower(basename((string)$n)) === strtolower(basename((string)$haystack)))) { return true; } } diff --git a/include/zid.php b/include/zid.php index e462f8357..ae7d9e252 100644 --- a/include/zid.php +++ b/include/zid.php @@ -37,7 +37,7 @@ function is_matrix_url($url) { * @return string */ function zid($s, $address = '') { - if (! strlen($s) || strpos($s,'zid=')) + if (!$s || strpos($s,'zid=')) return $s; $m = parse_url($s); -- cgit v1.2.3