-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
4.0.0-b1
-
None
\phpbb\ban\manager::unban() on master writes its admin and moderator log entries with the log data [$unbanned_users] (an array inside the data array), where ban() writes implode(', ', $items), a string. When the log is shown, language::lang_array() passes that array to vsprintf(), which raises a PHP warning.
For email and IP bans, after_unban() returns an empty array, so the log entry also never says what was unbanned.
For username bans, after_unban() returns user id => username, but the user-notes loop does foreach ($unbanned_users as $user_id), so it uses the usernames as user ids and the “unbanned” note is not filed under the right user.
The logging was added in d7389809aa (“[ticket/9687] Add support for logging to banning system”). phpBB 3.3’s user_unban() logs a joined string and is not affected.
Steps to reproduce:
On a master board with debug enabled, ban an email address in ACP > Users and Groups > Ban emails, then unban it.
Open the ACP front page or ACP > Maintenance > Admin log.
The page shows: PHP Warning: in file [ROOT]/phpbb/language/language.php on line 313: Array to string conversion. The stored log_data for the LOG_UNBAN_EMAIL entry is a:1:{i:0;a:0:{}}.
Expected result: No warning. The unban log entry names what was unbanned, as the ban log entry does, and username unbans add a note to each unbanned user.
Actual result: A PHP warning wherever the admin or moderator log is shown, an unban entry that names nothing for email and IP bans, and no user note for username unbans.
Proposed fix: In unban(), log the unbanned items joined into a string, the same way ban() logs its items, and loop over the keys of $unbanned_users (the user ids) for the user notes. Existing log rows already written with an array would still warn; a migration could rewrite them, or the fix can leave them, which should be decided in review.
Found while testing an extension (phpbbmodders/ban-hammer) on phpBB master.

