@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.

Flatten "RemarkupValue" objects when setting field defaults for custom forms

Summary:
Ref T13685. "RemarkupEditField" uses a "RemarkupValue" internally, and it currently attempts to serialize into the database unsuccessfully.

Instead, flatten the value before returning it for storage.

Test Plan:
- Edited the default description of a task in a custom form.

Maniphest Tasks: T13685

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

+27 -1
+26
src/applications/transactions/editfield/PhabricatorRemarkupEditField.php
··· 29 29 return $value; 30 30 } 31 31 32 + public function getValueForDefaults() { 33 + $value = parent::getValueForDefaults(); 34 + 35 + if ($value instanceof RemarkupValue) { 36 + $value = $value->getCorpus(); 37 + } 38 + 39 + return $value; 40 + } 41 + 42 + protected function getDefaultValueFromConfiguration($value) { 43 + 44 + // See T13685. After changes to file attachment handling, the database 45 + // was briefly poisoned with "array()" values as defaults. 46 + 47 + try { 48 + $value = phutil_string_cast($value); 49 + } catch (Exception $ex) { 50 + $value = ''; 51 + } catch (Throwable $ex) { 52 + $value = ''; 53 + } 54 + 55 + return $value; 56 + } 57 + 32 58 public function getMetadata() { 33 59 $defaults = array(); 34 60
+1 -1
src/view/form/control/AphrontFormTextAreaControl.php
··· 73 73 74 74 // NOTE: This needs to be string cast, because if we pass `null` the 75 75 // tag will be self-closed and some browsers aren't thrilled about that. 76 - $value = (string)$this->getValue(); 76 + $value = phutil_string_cast($this->getValue()); 77 77 78 78 // NOTE: We also need to prefix the string with a newline, because browsers 79 79 // ignore a newline immediately after a <textarea> tag, so they'll eat