From b04da9b811d79b3ae88f26e65e54120881dcd56a Mon Sep 17 00:00:00 2001 From: plegall Date: Sun, 31 Mar 2024 17:09:25 +0200 Subject: [PATCH] (cp 929bd1bd7) fixes #2142 truncate tags_strings if longer than 50 chars --- include/functions.inc.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/functions.inc.php b/include/functions.inc.php index c569819a3..4a2727eba 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -452,6 +452,14 @@ UPDATE '.USER_INFOS_TABLE.' if ('tags'==@$page['section']) { $tags_string = implode(',', $page['tag_ids']); + + if (strlen($tags_string) > 50) + { + // we need to truncate, mysql won't accept a too long string + $tags_string = substr($tags_string, 0, 50); + // the last tag_id may have been truncated itself, so we must remove it + $tags_string = substr($tags_string, 0, strrpos($tags_string, ',')); + } } $ip = $_SERVER['REMOTE_ADDR'];