diff --git a/src/applications/config/option/PhabricatorApplicationConfigOptions.php b/src/applications/config/option/PhabricatorApplicationConfigOptions.php index d99cdf3101..491852eab6 100644 --- a/src/applications/config/option/PhabricatorApplicationConfigOptions.php +++ b/src/applications/config/option/PhabricatorApplicationConfigOptions.php @@ -21,7 +21,14 @@ abstract class PhabricatorApplicationConfigOptions extends Phobject { } if ($option->isCustomType()) { - return $option->getCustomObject()->validateOption($option, $value); + try { + return $option->getCustomObject()->validateOption($option, $value); + } catch (Exception $ex) { + // If custom validators threw exceptions, convert them to configuation + // validation exceptions so we repair the configuration and raise + // an error. + throw new PhabricatorConfigValidationException($ex->getMessage()); + } } switch ($option->getType()) { diff --git a/src/applications/maniphest/constants/ManiphestTaskPriority.php b/src/applications/maniphest/constants/ManiphestTaskPriority.php index 6bd1460628..16a35a9e83 100644 --- a/src/applications/maniphest/constants/ManiphestTaskPriority.php +++ b/src/applications/maniphest/constants/ManiphestTaskPriority.php @@ -116,7 +116,15 @@ final class ManiphestTaskPriority extends ManiphestConstants { return $config; } - public static function validateConfiguration(array $config) { + public static function validateConfiguration($config) { + if (!is_array($config)) { + throw new Exception( + pht( + 'Configuration is not valid. Maniphest priority configurations '. + 'must be dictionaries.', + $config)); + } + foreach ($config as $key => $value) { if (!ctype_digit((string)$key)) { throw new Exception(