@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix excessively harsh validation of certain complex configuration

Summary:
See IRC. We're supposed to repair configuration, but if custom validators throw a generic `Exception` or use `PhutilTypeSpec` to do a check, we may explode way harder than we intend to.

Instead, soften these exceptions into validation exceptions so we repair configuration, raise a setup issue, and continue.

Test Plan: {F1059609}

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D14998

+17 -2
+8 -1
src/applications/config/option/PhabricatorApplicationConfigOptions.php
··· 21 21 } 22 22 23 23 if ($option->isCustomType()) { 24 - return $option->getCustomObject()->validateOption($option, $value); 24 + try { 25 + return $option->getCustomObject()->validateOption($option, $value); 26 + } catch (Exception $ex) { 27 + // If custom validators threw exceptions, convert them to configuation 28 + // validation exceptions so we repair the configuration and raise 29 + // an error. 30 + throw new PhabricatorConfigValidationException($ex->getMessage()); 31 + } 25 32 } 26 33 27 34 switch ($option->getType()) {
+9 -1
src/applications/maniphest/constants/ManiphestTaskPriority.php
··· 116 116 return $config; 117 117 } 118 118 119 - public static function validateConfiguration(array $config) { 119 + public static function validateConfiguration($config) { 120 + if (!is_array($config)) { 121 + throw new Exception( 122 + pht( 123 + 'Configuration is not valid. Maniphest priority configurations '. 124 + 'must be dictionaries.', 125 + $config)); 126 + } 127 + 120 128 foreach ($config as $key => $value) { 121 129 if (!ctype_digit((string)$key)) { 122 130 throw new Exception(