From a84477ed2d0e30e9a001d5ffa7f5cabc47ee7f3c Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 23 Apr 2018 00:00:06 -0400 Subject: [PATCH 1/5] Fix count() warning in include/dba.php --- include/dba.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/dba.php b/include/dba.php index bac61ec2f..d2f631c06 100644 --- a/include/dba.php +++ b/include/dba.php @@ -971,7 +971,7 @@ class dba { // Split the SQL queries in chunks of 100 values // We do the $i stuff here to make the code better readable $i = $counter[$key_table][$key_condition]; - if (count($compacted[$key_table][$key_condition][$i]) > 100) { + if (isset($compacted[$key_table][$key_condition][$i]) && count($compacted[$key_table][$key_condition][$i]) > 100) { ++$i; } From da4892b4d2c295925dab2c6263c8bb37dfa5a845 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 23 Apr 2018 00:00:29 -0400 Subject: [PATCH 2/5] Fix count() warning in mod/friendica - Add default value for Config call --- mod/friendica.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mod/friendica.php b/mod/friendica.php index 6c143634c..1929150f2 100644 --- a/mod/friendica.php +++ b/mod/friendica.php @@ -116,14 +116,14 @@ function friendica_content(App $a) } else { $o .= '

' . L10n::t('No installed addons/apps') . '

' . PHP_EOL; } - + if (Config::get('system', 'tosdisplay')) { $o .= '

'.L10n::t('Read about the Terms of Service of this node.', System::baseurl()).'

'; } - $blocklist = Config::get('system', 'blocklist'); - if (count($blocklist)) { + $blocklist = Config::get('system', 'blocklist', []); + if (!empty($blocklist)) { $o .= '

' . L10n::t('On this server the following remote servers are blocked.') . '

' . PHP_EOL; $o .= '' . PHP_EOL; foreach ($blocklist as $b) { From b0564ea40df08ecf8d1111d145cca749c993d0c4 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 23 Apr 2018 00:01:46 -0400 Subject: [PATCH 3/5] Fix count() warning in Model\Profile - Replace x() calls with empty() in Profile::load - Remove extraneous $a->page['aside'] initialization --- src/Model/Profile.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Model/Profile.php b/src/Model/Profile.php index cd8fa29e1..f86fce9b2 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -92,14 +92,14 @@ class Profile { $user = dba::selectFirst('user', ['uid'], ['nickname' => $nickname]); - if (!$user && !count($user) && !count($profiledata)) { + if (!DBM::is_result($user) && empty($profiledata)) { logger('profile error: ' . $a->query_string, LOGGER_DEBUG); notice(L10n::t('Requested account is not available.') . EOL); $a->error = 404; return; } - if (!x($a->page, 'aside')) { + if (empty($a->page['aside'])) { $a->page['aside'] = ''; } @@ -157,10 +157,6 @@ class Profile require_once $theme_info_file; } - if (!x($a->page, 'aside')) { - $a->page['aside'] = ''; - } - if (local_user() && local_user() == $a->profile['uid'] && $profiledata) { $a->page['aside'] .= replace_macros( get_markup_template('profile_edlink.tpl'), From 9b052b5ea8c576ffc6710392831cc63a48b11538 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 23 Apr 2018 00:02:18 -0400 Subject: [PATCH 4/5] Fix count() warning in Object\Post --- src/Object/Post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Object/Post.php b/src/Object/Post.php index 86e141467..820730a32 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -78,7 +78,7 @@ class Post extends BaseObject } // Prepare the children - if (count($data['children'])) { + if (!empty($data['children'])) { foreach ($data['children'] as $item) { // Only add will be displayed if ($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) { From 00985fe340f87156fb97f02e5e4f781e4530d932 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 23 Apr 2018 00:03:27 -0400 Subject: [PATCH 5/5] Fix self warning in Util\Temporal --- src/Util/Temporal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Util/Temporal.php b/src/Util/Temporal.php index 1ed08ed1d..46bd8bba5 100644 --- a/src/Util/Temporal.php +++ b/src/Util/Temporal.php @@ -59,7 +59,7 @@ class Temporal $o = '
' . L10n::t('Blocked domain') . '' . L10n::t('Reason for the block') . '