Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/transactions/editfield/PhabricatorRemarkupEditField.php b/src/applications/transactions/editfield/PhabricatorRemarkupEditField.php
index a299aa0b5c..a2e0debd39 100644
--- a/src/applications/transactions/editfield/PhabricatorRemarkupEditField.php
+++ b/src/applications/transactions/editfield/PhabricatorRemarkupEditField.php
@@ -1,47 +1,73 @@
<?php
final class PhabricatorRemarkupEditField
extends PhabricatorEditField {
protected function newControl() {
return new PhabricatorRemarkupControl();
}
protected function newHTTPParameterType() {
return new AphrontRemarkupHTTPParameterType();
}
protected function newConduitParameterType() {
return new ConduitStringParameterType();
}
protected function newBulkParameterType() {
return new BulkRemarkupParameterType();
}
public function getValueForTransaction() {
$value = $this->getValue();
if ($value instanceof RemarkupValue) {
$value = $value->getCorpus();
}
return $value;
}
+ public function getValueForDefaults() {
+ $value = parent::getValueForDefaults();
+
+ if ($value instanceof RemarkupValue) {
+ $value = $value->getCorpus();
+ }
+
+ return $value;
+ }
+
+ protected function getDefaultValueFromConfiguration($value) {
+
+ // See T13685. After changes to file attachment handling, the database
+ // was briefly poisoned with "array()" values as defaults.
+
+ try {
+ $value = phutil_string_cast($value);
+ } catch (Exception $ex) {
+ $value = '';
+ } catch (Throwable $ex) {
+ $value = '';
+ }
+
+ return $value;
+ }
+
public function getMetadata() {
$defaults = array();
$value = $this->getValue();
if ($value instanceof RemarkupValue) {
$defaults['remarkup.control'] = $value->getMetadata();
}
$metadata = parent::getMetadata();
$metadata = $metadata + $defaults;
return $metadata;
}
}
diff --git a/src/view/form/control/AphrontFormTextAreaControl.php b/src/view/form/control/AphrontFormTextAreaControl.php
index 2665c6aaa7..e548916fbb 100644
--- a/src/view/form/control/AphrontFormTextAreaControl.php
+++ b/src/view/form/control/AphrontFormTextAreaControl.php
@@ -1,98 +1,98 @@
<?php
/**
* @concrete-extensible
*/
class AphrontFormTextAreaControl extends AphrontFormControl {
const HEIGHT_VERY_SHORT = 'very-short';
const HEIGHT_SHORT = 'short';
const HEIGHT_VERY_TALL = 'very-tall';
private $height;
private $readOnly;
private $customClass;
private $placeHolder;
private $sigil;
public function setSigil($sigil) {
$this->sigil = $sigil;
return $this;
}
public function getSigil() {
return $this->sigil;
}
public function setPlaceHolder($place_holder) {
$this->placeHolder = $place_holder;
return $this;
}
private function getPlaceHolder() {
return $this->placeHolder;
}
public function setHeight($height) {
$this->height = $height;
return $this;
}
public function setReadOnly($read_only) {
$this->readOnly = $read_only;
return $this;
}
protected function getReadOnly() {
return $this->readOnly;
}
protected function getCustomControlClass() {
return 'aphront-form-control-textarea';
}
public function setCustomClass($custom_class) {
$this->customClass = $custom_class;
return $this;
}
protected function renderInput() {
$height_class = null;
switch ($this->height) {
case self::HEIGHT_VERY_SHORT:
case self::HEIGHT_SHORT:
case self::HEIGHT_VERY_TALL:
$height_class = 'aphront-textarea-'.$this->height;
break;
}
$classes = array();
$classes[] = $height_class;
$classes[] = $this->customClass;
$classes = trim(implode(' ', $classes));
// NOTE: This needs to be string cast, because if we pass `null` the
// tag will be self-closed and some browsers aren't thrilled about that.
- $value = (string)$this->getValue();
+ $value = phutil_string_cast($this->getValue());
// NOTE: We also need to prefix the string with a newline, because browsers
// ignore a newline immediately after a <textarea> tag, so they'll eat
// leading newlines if we don't do this. See T8707.
$value = "\n".$value;
return javelin_tag(
'textarea',
array(
'name' => $this->getName(),
'disabled' => $this->getDisabled() ? 'disabled' : null,
'readonly' => $this->getReadOnly() ? 'readonly' : null,
'class' => $classes,
'style' => $this->getControlStyle(),
'id' => $this->getID(),
'sigil' => $this->sigil,
'placeholder' => $this->getPlaceHolder(),
),
$value);
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jul 27, 4:31 PM (1 w, 13 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
186003
Default Alt Text
(4 KB)

Event Timeline