Discard about me messages that exceed the limits
authorAlexander Ebert <ebert@woltlab.com>
Sat, 14 Jan 2017 20:18:00 +0000 (21:18 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 14 Jan 2017 20:18:00 +0000 (21:18 +0100)
wcfsetup/install/files/lib/system/worker/UserRebuildDataWorker.class.php

index 4e18b78f17c99fcb1bf4c548790a42dc33315160..d7c17e82e8364b6124c35962c8cf38cca401a580 100644 (file)
@@ -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
                                                ]);
                                        }