From c4e9fe800bb3261ca30e670f8e278b6dfa489cb7 Mon Sep 17 00:00:00 2001 From: Shawn Bulen Date: Mon, 11 Nov 2024 09:29:08 -0800 Subject: [PATCH] Cast to string when used as array key Signed by Shawn Bulen, bulens@pacbell.net --- Sources/Actions/Admin/Members.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Sources/Actions/Admin/Members.php b/Sources/Actions/Admin/Members.php index 99108b34dd..097df850a0 100644 --- a/Sources/Actions/Admin/Members.php +++ b/Sources/Actions/Admin/Members.php @@ -1519,16 +1519,16 @@ protected static function populateDuplicateMembers(array &$members): void 'name' => $row['member_name'], 'email' => $row['email_address'], 'is_banned' => $row['is_activated'] >= User::BANNED, - 'ip' => $row['member_ip']->__toString(), - 'ip2' => $row['member_ip2']->__toString(), + 'ip' => (string) $row['member_ip'], + 'ip2' => (string) $row['member_ip2'], ]; - if (in_array($row['member_ip']->__toString(), $ips)) { - $duplicate_members[$row['member_ip']->__toString()][] = $member_context; + if (in_array((string) $row['member_ip'], $ips)) { + $duplicate_members[(string) $row['member_ip']][] = $member_context; } - if ($row['member_ip']->__toString() != $row['member_ip2']->__toString() && in_array($row['member_ip2']->__toString(), $ips)) { - $duplicate_members[$row['member_ip2']->__toString()][] = $member_context; + if ((string) $row['member_ip'] != (string) $row['member_ip2'] && in_array((string) $row['member_ip2'], $ips)) { + $duplicate_members[(string) $row['member_ip2']][] = $member_context; } } Db::$db->free_result($request); @@ -1555,19 +1555,19 @@ protected static function populateDuplicateMembers(array &$members): void $row['poster_ip'] = new IP($row['poster_ip']); // Don't collect lots of the same. - if (isset($had_ips[$row['poster_ip']->__toString()]) && in_array($row['id_member']->__toString(), $had_ips[$row['poster_ip']->__toString()])) { + if (isset($had_ips[(string) $row['poster_ip']]) && in_array((string) $row['id_member'], $had_ips[(string) $row['poster_ip']])) { continue; } - $had_ips[$row['poster_ip']->__toString()][] = $row['id_member']; + $had_ips[(string) $row['poster_ip']][] = $row['id_member']; - $duplicate_members[$row['poster_ip']->__toString()][] = [ + $duplicate_members[(string) $row['poster_ip']][] = [ 'id' => $row['id_member'], 'name' => $row['member_name'], 'email' => $row['email_address'], 'is_banned' => $row['is_activated'] >= User::BANNED, - 'ip' => $row['poster_ip']->__toString(), - 'ip2' => $row['poster_ip']->__toString(), + 'ip' => (string) $row['poster_ip'], + 'ip2' => (string) $row['poster_ip'], ]; } Db::$db->free_result($request); @@ -1575,12 +1575,12 @@ protected static function populateDuplicateMembers(array &$members): void // Now we have all the duplicate members, stick them with their respective member in the list. if (!empty($duplicate_members)) { foreach ($members as $key => $member) { - if (isset($duplicate_members[$member['member_ip']->__toString()])) { - $members[$key]['duplicate_members'] = $duplicate_members[$member['member_ip']->__toString()]; + if (isset($duplicate_members[(string) $member['member_ip']])) { + $members[$key]['duplicate_members'] = $duplicate_members[(string) $member['member_ip']]; } - if ($member['member_ip'] != $member['member_ip2'] && isset($duplicate_members[$member['member_ip2']->__toString()])) { - $members[$key]['duplicate_members'] = array_merge($member['duplicate_members'], $duplicate_members[$member['member_ip2']->__toString()]); + if ($member['member_ip'] != $member['member_ip2'] && isset($duplicate_members[(string) $member['member_ip2']])) { + $members[$key]['duplicate_members'] = array_merge($member['duplicate_members'], $duplicate_members[(string) $member['member_ip2']]); } // Check we don't have lots of the same member.