Fix `TSelectionFormField::_options = null` if no options are passed
authorMatthias Schmidt <gravatronics@live.com>
Tue, 31 Jul 2018 14:42:09 +0000 (16:42 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 31 Jul 2018 14:42:09 +0000 (16:42 +0200)
See #2509

wcfsetup/install/files/lib/system/form/builder/field/TSelectionFormField.class.php

index 26dddcc92b3c42e5958f82a96986d1fdcfd62195..dbfa5e4bc8ee01f37dd8e69b55eaf85d3d1333e9 100644 (file)
@@ -160,6 +160,7 @@ trait TSelectionFormField {
                        $options = $dboOptions;
                }
                
+               $this->__options = [];
                if ($nestedOptions) {
                        foreach ($options as $key => &$option) {
                                if (!is_array($option)) {
@@ -252,8 +253,7 @@ trait TSelectionFormField {
                        }
                }
                
-               if ($this->__options === null) {
-                       $this->__options = [];
+               if ($this->__nestedOptions === null) {
                        $this->__nestedOptions = [];
                }