From 1c22c458b5cc1509e2d39f8c673b7b755cd588e5 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 14 Jan 2017 21:18:00 +0100 Subject: [PATCH] Discard about me messages that exceed the limits --- .../lib/system/worker/UserRebuildDataWorker.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/worker/UserRebuildDataWorker.class.php b/wcfsetup/install/files/lib/system/worker/UserRebuildDataWorker.class.php index 4e18b78f17..d7c17e82e8 100644 --- a/wcfsetup/install/files/lib/system/worker/UserRebuildDataWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/UserRebuildDataWorker.class.php @@ -104,8 +104,17 @@ class UserRebuildDataWorker extends AbstractRebuildDataWorker { if ($user->aboutMe) { $htmlInputProcessor->process($user->aboutMe, 'com.woltlab.wcf.user.aboutMe', $user->userID, true); + $html = $htmlInputProcessor->getHtml(); + // MySQL's TEXT type allows for 65,535 bytes, hence we need to count + // the bytes rather than the actual amount of characters + if (strlen($html) > 65535) { + // content does not fit the available space, and any + // attempts to truncate it will yield awkward results + $html = ''; + } + $statement->execute([ - $htmlInputProcessor->getHtml(), + $html, $user->userID ]); } -- 2.20.1