Skip to content

Ticket/17753 Log unbanned items as a string and fix unban user notes - #7102

Open
bonelifer wants to merge 2 commits into
phpbb:masterfrom
bonelifer:ticket/17753
Open

bonelifer wants to merge 2 commits into
phpbb:masterfrom
bonelifer:ticket/17753

Conversation

@bonelifer

Copy link
Copy Markdown
Member

Checklist:

  • Correct branch: master for new features; 3.3.x for fixes
  • Tests pass
  • Code follows coding guidelines: master and 3.3.x
  • Commit follows commit message format

Tracker ticket:

https://tracker.phpbb.com/browse/PHPBB-17753

\phpbb\ban\manager::unban() logged [$unbanned_users], an array, where ban() logs a joined string. Showing the admin or moderator log then gave Array to string conversion in language::lang_array(), and email and IP unbans named nothing, because after_unban() returns an empty array for those types. This logs the unbanned usernames, or the email addresses or IPs, as one string, the way ban() does.

The user-notes loop also used the values of after_unban() (usernames) as user ids, so unbanned users never got their note. It now loops over the keys.

The new test_unban_logs in tests/ban/ban_manager_test.php covers user, email and IP unbans. Run locally in Docker with SQLite, it fails on current master and passes with this change; the rest of the ban manager tests, the session ban check and the email validation tests also pass.

Log rows already written with an array still warn when shown. This PR leaves them alone; a migration could rewrite them if wanted.


Investigated and written by Claude on behalf of William Jacoby (bonelifer).

ban\manager::unban() logged [$unbanned_users], an array, where ban()
logs a joined string, so showing the admin or moderator log gave an
"Array to string conversion" warning, and email and IP unbans named
nothing. Log the unbanned usernames, or the email addresses or IPs, as
one string, like ban() does.

The user-notes loop also took the usernames from after_unban() as user
ids; loop over its keys instead. Add a test for all three ban types.

PHPBB-17753
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants