Throw an error for user group options lacking a type
authorAlexander Ebert <ebert@woltlab.com>
Mon, 29 Jan 2018 11:37:46 +0000 (12:37 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 29 Jan 2018 11:37:46 +0000 (12:37 +0100)
wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php

index b8d44de063654cda7a860363d09784b2725f3a3d..ba5dc0667d0e35bbf239d6dd232eec124de766f8 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\user\group\option\UserGroupOption;
 use wcf\data\user\group\option\UserGroupOptionEditor;
 use wcf\data\user\group\UserGroup;
 use wcf\system\devtools\pip\IIdempotentPackageInstallationPlugin;
+use wcf\system\exception\SystemException;
 use wcf\system\WCF;
 use wcf\util\StringUtil;
 
@@ -57,6 +58,10 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst
                if (isset($option['options'])) $options = StringUtil::normalizeCsv($option['options']);
                if (isset($option['usersonly'])) $usersOnly = $option['usersonly'];
                
+               if (empty($optionType)) {
+                       throw new SystemException("Expected a non-empty 'optiontype' value for the option  '".$optionName."'.");
+               }
+               
                // force the `html` bbcode to be disabled by default
                if ($optionType === 'BBCodeSelect') {
                        $defaultValue .= (empty($defaultValue) ? '' : ',') . 'html';