From 6241d7087f01473f5c5b98a6db7e1d8922ad07ac Mon Sep 17 00:00:00 2001 From: albertlast Date: Fri, 4 Sep 2026 23:11:28 +0200 Subject: [PATCH] Keeps a reported profile's name inside the column that stores it Reporting a profile labels the report with the member's display name and their username in brackets after it. Both names come out of the database entity encoded, and both are wide enough on their own that the pair does not necessarily fit the 255 characters log_reported.membername holds: real_name is 255 wide and member_name 80. The display name gets there because the profile validator counts the characters that were typed while the column stores the encoded form of them. A display name of 42 double quotes is 42 characters to the validator, well inside the limit of 60, and 252 characters in the column. Reporting that profile builds a 259 character label, and the insert fails with "Data too long for column 'membername'". Adds the username only when there is room for it. The display name is what identifies the member, and it came out of a column the same width, so it always fits on its own. Co-Authored-By: Claude Opus 5 Signed-off-by: albertlast --- Sources/Actions/ReportToMod.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Sources/Actions/ReportToMod.php b/Sources/Actions/ReportToMod.php index 392a091811..0fff825533 100644 --- a/Sources/Actions/ReportToMod.php +++ b/Sources/Actions/ReportToMod.php @@ -524,7 +524,19 @@ protected function reportMember(int $id_member): void $user = Db::$db->fetch_assoc($request); Db::$db->free_result($request); - $user_name = $user['real_name'] . ($user['real_name'] != $user['member_name'] ? ' (' . $user['member_name'] . ')' : ''); + $user_name = $user['real_name']; + + if ($user['real_name'] != $user['member_name']) { + $with_username = $user['real_name'] . ' (' . $user['member_name'] . ')'; + + // Both names arrive from the database already entity encoded, and + // membername holds 255 characters, so the username goes on the end + // only when there is room for it. A display name is entitled to the + // space on its own. + if (mb_strlen($with_username) <= 255) { + $user_name = $with_username; + } + } $request = Db::$db->query( 'SELECT id_report, ignore_all