diff --git a/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php b/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php index bb1c445bec..bb030154d1 100644 --- a/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php +++ b/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php @@ -27,6 +27,7 @@ final class PhabricatorCustomFieldList extends Phobject { return $this; } + /** * Read stored values for all fields which support storage. * @@ -65,7 +66,9 @@ final class PhabricatorCustomFieldList extends Phobject { $storage = idx($objects, $key); if ($storage) { $field->setValueFromStorage($storage->getFieldValue()); - } else { + } else if ($object->getPHID()) { + // NOTE: We set this only if the object exists. Otherwise, we allow the + // field to retain any default value it may have. $field->setValueFromStorage(null); } } diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php index 7d73234655..2f79bfd22b 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php @@ -108,6 +108,9 @@ abstract class PhabricatorStandardCustomField $this->setRequired($value); $this->setFieldError(true); break; + case 'default': + $this->setFieldValue($value); + break; case 'type': // We set this earlier on. break;