From: Alexander Ebert Date: Sun, 27 Jan 2013 15:32:00 +0000 (+0100) Subject: Removed validation of object type existence X-Git-Tag: 2.0.0_Beta_1~533^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8dab7c933dfb6c22f30b8744df75b9b2bb0d6a39;p=GitHub%2FWoltLab%2FWCF.git Removed validation of object type existence We explicitly want to allow option types to be provided by an application, but the current system does not allow bogus autoload paths to be registered on runtime. Since a bad object type is a developer's fault we can safely ignore it here. If it fails, blame him. --- diff --git a/wcfsetup/install/files/lib/system/package/plugin/OptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/OptionPackageInstallationPlugin.class.php index 6e80df3df8..8d277eb9ad 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/OptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/OptionPackageInstallationPlugin.class.php @@ -59,11 +59,6 @@ class OptionPackageInstallationPlugin extends AbstractOptionPackageInstallationP if (isset($option['supporti18n'])) $supportI18n = $option['supporti18n']; if (isset($option['requirei18n'])) $requireI18n = $option['requirei18n']; - // check if optionType exists - if (!$this->validateOptionType($optionType)) { - throw new SystemException("unable to find option type '".$optionType."'"); - } - // collect additional tags and their values $additionalData = array(); foreach ($option as $tag => $value) { @@ -116,39 +111,4 @@ class OptionPackageInstallationPlugin extends AbstractOptionPackageInstallationP $optionEditor->update($data); } } - - /** - * Returns true, if option type is valid. - * - * @param integer $optionType - * @return boolean - */ - protected function validateOptionType($optionType) { - $optionType = StringUtil::firstCharToUpperCase($optionType); - - // attempt to validate against WCF first - $className = 'wcf\system\option\\'.$optionType.'OptionType'; - if (class_exists($className)) { - return true; - } - - // check for applications - if (self::$abbreviations === null) { - self::$abbreviations = array(); - - $applications = ApplicationHandler::getInstance()->getApplications(); - foreach ($applications as $application) { - self::$abbreviations[] = ApplicationHandler::getInstance()->getAbbreviation($application->packageID); - } - } - - foreach (self::$abbreviations as $abbreviation) { - $className = $abbreviation.'\system\option\\'.$optionType.'OptionType'; - if (class_exists($className)) { - return true; - } - } - - return false; - } } diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php index 31508e84db..fa6e963e87 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php @@ -62,12 +62,6 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst if (isset($option['permissions'])) $permissions = $option['permissions']; if (isset($option['options'])) $options = $option['options']; - // check if optionType exists - $className = 'wcf\system\option\user\group\\'.StringUtil::firstCharToUpperCase($optionType).'UserGroupOptionType'; - if (!class_exists($className)) { - throw new SystemException("unable to find class '".$className."'"); - } - // collect additional tags and their values $additionalData = array(); foreach ($option as $tag => $value) { diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php index 23677bac6d..149759b3a7 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php @@ -85,12 +85,6 @@ class UserOptionPackageInstallationPlugin extends AbstractOptionPackageInstallat if (isset($option['permissions'])) $permissions = $option['permissions']; if (isset($option['options'])) $options = $option['options']; - // check if optionType exists - $className = 'wcf\system\option\\'.StringUtil::firstCharToUpperCase($optionType).'OptionType'; - if (!class_exists($className)) { - throw new SystemException("unable to find class '".$className."'"); - } - // collect additional tags and their values $additionalData = array(); foreach ($option as $tag => $value) {