Page MenuHomePhabricator

D14184.diff
No OneTemporary

D14184.diff

diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php
--- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php
+++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php
@@ -93,15 +93,8 @@
public function getApplicationTransactionRequiredHandlePHIDs(
PhabricatorApplicationTransaction $xaction) {
- $old = json_decode($xaction->getOldValue());
- if (!is_array($old)) {
- $old = array();
- }
-
- $new = json_decode($xaction->getNewValue());
- if (!is_array($new)) {
- $new = array();
- }
+ $old = $this->decodeValue($xaction->getOldValue());
+ $new = $this->decodeValue($xaction->getNewValue());
$add = array_diff($new, $old);
$rem = array_diff($old, $new);
@@ -113,15 +106,8 @@
PhabricatorApplicationTransaction $xaction) {
$author_phid = $xaction->getAuthorPHID();
- $old = json_decode($xaction->getOldValue());
- if (!is_array($old)) {
- $old = array();
- }
-
- $new = json_decode($xaction->getNewValue());
- if (!is_array($new)) {
- $new = array();
- }
+ $old = $this->decodeValue($xaction->getOldValue());
+ $new = $this->decodeValue($xaction->getNewValue());
$add = array_diff($new, $old);
$rem = array_diff($old, $new);
@@ -167,8 +153,8 @@
// some invalid or restricted values, but they can't add new ones.
foreach ($xactions as $xaction) {
- $old = phutil_json_decode($xaction->getOldValue());
- $new = phutil_json_decode($xaction->getNewValue());
+ $old = $this->decodeValue($xaction->getOldValue());
+ $new = $this->decodeValue($xaction->getNewValue());
$add = array_diff($new, $old);
@@ -231,4 +217,13 @@
return array();
}
+ private function decodeValue($value) {
+ $value = json_decode($value);
+ if (!is_array($value)) {
+ $value = array();
+ }
+
+ return $value;
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Mon, May 13, 11:23 PM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6293856
Default Alt Text
D14184.diff (2 KB)

Event Timeline