Force case-insensitive check for smiley codes
authorAlexander Ebert <ebert@woltlab.com>
Mon, 23 May 2022 17:08:46 +0000 (19:08 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 23 May 2022 17:08:46 +0000 (19:08 +0200)
The smiley table uses a case-insensitive unique key for the smiley code.

See https://www.woltlab.com/community/thread/295708-bug-beim-erstellen-eines-smileys-mit-bereits-vorhandenem-smileycode-duplikat/

wcfsetup/install/files/lib/acp/form/SmileyAddForm.class.php

index 1544fadf650b6c92f289f2341ebe57f1b02a55b9..19ebe53dbd0373be4a01838059920e6caea6bc67 100644 (file)
@@ -371,14 +371,16 @@ class SmileyAddForm extends AbstractForm
         $statement->execute($conditionBuilder->getParameters());
 
         $aliases = \explode("\n", $this->aliases);
+        $aliases = \array_map('\mb_strtolower', $aliases);
         while ($row = $statement->fetchArray()) {
             $known = [];
             if (!empty($row['aliases'])) {
                 $known = \explode("\n", $row['aliases']);
             }
             $known[] = $row['smileyCode'];
+            $known = \array_map('\mb_strtolower', $known);
 
-            if (\in_array($this->smileyCode, $known)) {
+            if (\in_array(\mb_strtolower($this->smileyCode), $known)) {
                 throw new UserInputException('smileyCode', 'notUnique');
             } else {
                 $conflicts = \array_intersect($aliases, $known);