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

Simplify value decoding for PHID custom fields

Summary:
Ref T9123. The handling in D14183 didn't deal with new field values properly.

Make all this handling more consistent.

Test Plan: Created a new WorkignCopy build plan with some repos.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9123

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

+15 -20
+15 -20
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php
··· 93 93 public function getApplicationTransactionRequiredHandlePHIDs( 94 94 PhabricatorApplicationTransaction $xaction) { 95 95 96 - $old = json_decode($xaction->getOldValue()); 97 - if (!is_array($old)) { 98 - $old = array(); 99 - } 100 - 101 - $new = json_decode($xaction->getNewValue()); 102 - if (!is_array($new)) { 103 - $new = array(); 104 - } 96 + $old = $this->decodeValue($xaction->getOldValue()); 97 + $new = $this->decodeValue($xaction->getNewValue()); 105 98 106 99 $add = array_diff($new, $old); 107 100 $rem = array_diff($old, $new); ··· 113 106 PhabricatorApplicationTransaction $xaction) { 114 107 $author_phid = $xaction->getAuthorPHID(); 115 108 116 - $old = json_decode($xaction->getOldValue()); 117 - if (!is_array($old)) { 118 - $old = array(); 119 - } 120 - 121 - $new = json_decode($xaction->getNewValue()); 122 - if (!is_array($new)) { 123 - $new = array(); 124 - } 109 + $old = $this->decodeValue($xaction->getOldValue()); 110 + $new = $this->decodeValue($xaction->getNewValue()); 125 111 126 112 $add = array_diff($new, $old); 127 113 $rem = array_diff($old, $new); ··· 167 153 // some invalid or restricted values, but they can't add new ones. 168 154 169 155 foreach ($xactions as $xaction) { 170 - $old = phutil_json_decode($xaction->getOldValue()); 171 - $new = phutil_json_decode($xaction->getNewValue()); 156 + $old = $this->decodeValue($xaction->getOldValue()); 157 + $new = $this->decodeValue($xaction->getNewValue()); 172 158 173 159 $add = array_diff($new, $old); 174 160 ··· 229 215 return $value; 230 216 } 231 217 return array(); 218 + } 219 + 220 + private function decodeValue($value) { 221 + $value = json_decode($value); 222 + if (!is_array($value)) { 223 + $value = array(); 224 + } 225 + 226 + return $value; 232 227 } 233 228 234 229 }