Trim the description of a style package to 255 characters
authorAlexander Ebert <ebert@woltlab.com>
Sat, 16 Sep 2023 12:29:07 +0000 (14:29 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 16 Sep 2023 12:29:07 +0000 (14:29 +0200)
See https://www.woltlab.com/community/thread/301562-fehler-bei-zu-langem-text-in-der-stilbeschreibung/

wcfsetup/install/files/lib/data/style/StyleEditor.class.php

index 704e3c8eaf5822621771c02345b91b8cba78d389..1ba83ab8b459cacc64f46a6e187959beb0e1266d 100644 (file)
@@ -1176,6 +1176,10 @@ final class StyleEditor extends DatabaseObjectEditor implements IEditableCachedO
 
             // description
             foreach ($styleDescriptions as $languageCode => $value) {
+                // The description of a style is effectively stored in a TEXT column
+                // but packages use a VARCHAR(255) to store it.
+                $value = \mb_substr($value, 0, 255);
+
                 $xml->writeElement('packagedescription', $value, ['language' => $languageCode]);
             }