diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 3913b20090..c50e0d01ee 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -750,7 +750,7 @@ function user_delete($mode, $user_ids, $retain_username = true) // Delete the user_id from the banlist $sql = 'DELETE FROM ' . BANS_TABLE . ' - WHERE ban_mode = \'user\' AND ' . $db->sql_in_set('ban_item', $user_ids); + WHERE ban_mode = \'user\' AND ' . $db->sql_in_set('ban_userid', $user_ids); $db->sql_query($sql); // Delete the user_id from the session table diff --git a/phpBB/phpbb/ban/type/base.php b/phpBB/phpbb/ban/type/base.php index 92b324f9b3..84b9502dc1 100644 --- a/phpBB/phpbb/ban/type/base.php +++ b/phpBB/phpbb/ban/type/base.php @@ -115,7 +115,7 @@ abstract class base implements type_interface WHERE (ban_end >= ' . time() . " OR ban_end = 0) AND ban_mode = '{$this->get_type()}' - ORDER BY ban_item"; + ORDER BY ban_item, ban_id"; $result = $this->db->sql_query($sql); $rowset = $this->db->sql_fetchrowset($result); $this->db->sql_freeresult($result); diff --git a/phpBB/phpbb/ban/type/user.php b/phpBB/phpbb/ban/type/user.php index 7ad1195988..0971cf4cf4 100644 --- a/phpBB/phpbb/ban/type/user.php +++ b/phpBB/phpbb/ban/type/user.php @@ -140,7 +140,7 @@ class user extends base $this->banned_users = []; while ($row = $this->db->sql_fetchrow($result)) { - $ban_items[] = (int) $row['user_id']; + $ban_items[] = (string) $row['user_id']; $this->banned_users[(int) $row['user_id']] = $row['username']; } $this->db->sql_freeresult($result); diff --git a/tests/ban/ban_manager_test.php b/tests/ban/ban_manager_test.php index b8af909c7d..4034ad7966 100644 --- a/tests/ban/ban_manager_test.php +++ b/tests/ban/ban_manager_test.php @@ -225,9 +225,9 @@ class ban_manager_test extends \phpbb_session_test_case 'email', [ [ - 'ban_id' => '9', + 'ban_id' => '5', 'ban_userid' => 0, - 'ban_item' => '*@foo.bar', + 'ban_item' => 'bar@example.org', 'ban_start' => '1111', 'ban_end' => '0', 'ban_reason' => 'HAHAHA', @@ -235,9 +235,9 @@ class ban_manager_test extends \phpbb_session_test_case 'ban_mode' => 'email', ], [ - 'ban_id' => '5', + 'ban_id' => '9', 'ban_userid' => 0, - 'ban_item' => 'bar@example.org', + 'ban_item' => '*@foo.bar', 'ban_start' => '1111', 'ban_end' => '0', 'ban_reason' => 'HAHAHA', diff --git a/tests/functions_user/fixtures/delete_user.xml b/tests/functions_user/fixtures/delete_user.xml index 1727b8a783..c149a42429 100644 --- a/tests/functions_user/fixtures/delete_user.xml +++ b/tests/functions_user/fixtures/delete_user.xml @@ -38,6 +38,7 @@