From 95c728426a772d556e4af5def97d461c097bc81a Mon Sep 17 00:00:00 2001 From: Phosphorus Moscu Date: Thu, 18 Apr 2019 00:11:08 -0300 Subject: [PATCH 1/4] Update index.php Fixed the message "Warning: count()" In the index when is installed phpbb2 and you not have a moderator --- phpBB/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/index.php b/phpBB/index.php index 4e94041d125..667a5ee6463 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -420,7 +420,7 @@ $last_post = $lang['No_Posts']; } - if ( count($forum_moderators[$forum_id]) > 0 ) + if ( count($forum_moderators[$forum_id] ?? $forum_moderators ) > 0 ) { $l_moderators = ( count($forum_moderators[$forum_id]) == 1 ) ? $lang['Moderator'] : $lang['Moderators']; $moderator_list = implode(', ', $forum_moderators[$forum_id]); @@ -470,4 +470,4 @@ include($phpbb_root_path . 'includes/page_tail.'.$phpEx); -?> \ No newline at end of file +?> From 50025e7784502e0a86d7e5811ed6ad66f3dd723d Mon Sep 17 00:00:00 2001 From: Fernando Pastorelli Date: Thu, 18 Apr 2019 00:31:17 -0300 Subject: [PATCH 2/4] Simple changes --- phpBB/admin/index.php | 2 +- phpBB/index.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/admin/index.php b/phpBB/admin/index.php index 4e3e7367d93..a59d45657de 100644 --- a/phpBB/admin/index.php +++ b/phpBB/admin/index.php @@ -476,7 +476,7 @@ function inarray($needle, $haystack) // // Guest users // - if( count($onlinerow_guest) ) + if( $onlinerow_guest ? count($onlinerow_guest) : 0) { $guest_users = 0; diff --git a/phpBB/index.php b/phpBB/index.php index 4e94041d125..667a5ee6463 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -420,7 +420,7 @@ $last_post = $lang['No_Posts']; } - if ( count($forum_moderators[$forum_id]) > 0 ) + if ( count($forum_moderators[$forum_id] ?? $forum_moderators ) > 0 ) { $l_moderators = ( count($forum_moderators[$forum_id]) == 1 ) ? $lang['Moderator'] : $lang['Moderators']; $moderator_list = implode(', ', $forum_moderators[$forum_id]); @@ -470,4 +470,4 @@ include($phpbb_root_path . 'includes/page_tail.'.$phpEx); -?> \ No newline at end of file +?> From 8f8242e9231176be5ca3e35a029e50726ba874b7 Mon Sep 17 00:00:00 2001 From: Fernando Pastorelli Date: Thu, 18 Apr 2019 00:39:44 -0300 Subject: [PATCH 3/4] Other changes for fix the message the count... --- phpBB/admin/admin_user_ban.php | 7 ++++--- phpBB/admin/admin_words.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/phpBB/admin/admin_user_ban.php b/phpBB/admin/admin_user_ban.php index 1b18b4af5fd..041a95353d9 100644 --- a/phpBB/admin/admin_user_ban.php +++ b/phpBB/admin/admin_user_ban.php @@ -372,7 +372,8 @@ $db->sql_freeresult($result); $select_userlist = ''; - for($i = 0; $i < count($user_list); $i++) + $x = $user_list ? count($user_list) : 0; + for($i = 0; $i < $x; $i++) { $select_userlist .= ''; $userban_count++; @@ -397,8 +398,8 @@ $select_iplist = ''; $select_emaillist = ''; - - for($i = 0; $i < count($banlist); $i++) + $x = $banlist ? count($banlist) : 0; + for($i = 0; $i < $x; $i++) { $ban_id = $banlist[$i]['ban_id']; diff --git a/phpBB/admin/admin_words.php b/phpBB/admin/admin_words.php index b557531fb6a..90d7ec98dd4 100644 --- a/phpBB/admin/admin_words.php +++ b/phpBB/admin/admin_words.php @@ -232,7 +232,7 @@ $word_rows = $db->sql_fetchrowset($result); $db->sql_freeresult($result); - $word_count = count($word_rows); + $word_count = $word_rows ? count($word_rows) : 0; $template->assign_vars(array( "L_WORDS_TITLE" => $lang['Words_title'], From 717915d931b008870f9623822d5383dc36996509 Mon Sep 17 00:00:00 2001 From: Fernando Pastorelli Date: Fri, 3 May 2019 12:02:55 -0300 Subject: [PATCH 4/4] Fixing this... --- phpBB/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/index.php b/phpBB/index.php index 667a5ee6463..5929a1f5583 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -419,8 +419,8 @@ { $last_post = $lang['No_Posts']; } - - if ( count($forum_moderators[$forum_id] ?? $forum_moderators ) > 0 ) + + if ( count($forum_moderators[$forum_id] ?? [] ) > 0 ) { $l_moderators = ( count($forum_moderators[$forum_id]) == 1 ) ? $lang['Moderator'] : $lang['Moderators']; $moderator_list = implode(', ', $forum_moderators[$forum_id]);