Fix length comparison for aboutMe text in UserRebuildDataWorker
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 20 Feb 2023 09:10:06 +0000 (10:10 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 20 Feb 2023 09:10:06 +0000 (10:10 +0100)
Contrary to the comment's claim, a `TEXT` column supports 65535 characters
(depending on the charset), not 65535 bytes.

wcfsetup/install/files/lib/system/worker/UserRebuildDataWorker.class.php

index 7f4773e5200d34dfb6b86dbd69d5188b2abb476a..21e19ec67a277ba2a5c461927ca41c64449d5b66 100644 (file)
@@ -202,9 +202,7 @@ class UserRebuildDataWorker extends AbstractRebuildDataWorker
                     }
 
                     $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) {
+                    if (\mb_strlen($html) > 65535) {
                         // content does not fit the available space, and any
                         // attempts to truncate it will yield awkward results
                         $html = '';