From 73ef18a4853e11f02cce68ba51816981e2c5dfef Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 21 Jan 2020 17:49:42 +0100 Subject: [PATCH] Optional select fields were not optional because of a property mismatch --- .../lib/data/custom/option/CustomOption.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wcfsetup/install/files/lib/data/custom/option/CustomOption.class.php b/wcfsetup/install/files/lib/data/custom/option/CustomOption.class.php index dbed4ac1b9..851e0af319 100644 --- a/wcfsetup/install/files/lib/data/custom/option/CustomOption.class.php +++ b/wcfsetup/install/files/lib/data/custom/option/CustomOption.class.php @@ -39,6 +39,19 @@ abstract class CustomOption extends Option implements ITitledObject { */ protected $optionValue = ''; + /** + * @inheritDoc + */ + public function __get($name) { + // Some options support empty values, such as "select", but the code checks for the + // property `allowEmptyValue`, which is the inverse value of `required`. + if ($name === 'allowEmptyValue') { + return !$this->required; + } + + return parent::__get($name); + } + /** * @inheritDoc * @since 5.2 -- 2.20.1