Insert trim to remove empty values (#5615)
authorOlaf Braun <info@braun-development.de>
Mon, 14 Aug 2023 11:31:32 +0000 (13:31 +0200)
committerGitHub <noreply@github.com>
Mon, 14 Aug 2023 11:31:32 +0000 (13:31 +0200)
* Insert trim to remove empty values

* Expand the comment on the array trim a bit

---------

Co-authored-by: Alexander Ebert <ebert@woltlab.com>
wcfsetup/install/files/lib/system/form/builder/field/ItemListFormField.class.php

index 2d6e5019d33e89657b1b8057285fc457254734fc..457e1fee4ae7ba352ad5a6a22d88dfcad048f4b5 100644 (file)
@@ -245,6 +245,10 @@ class ItemListFormField extends AbstractFormField implements
                 throw new \LogicException("Unreachable");
         }
 
+        // If the input value is an empty string then the resulting array will
+        // contain exactly one empty string element.
+        $this->value = ArrayUtil::trim($this->value);
+
         return $this;
     }