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

Update callsites of `phutil_json_decode`.

Summary: Depends on D9634. `phutil_json_decode` now throws an exception on invalid JSON.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

+19 -28
+5 -12
src/applications/config/custom/PhabricatorConfigJSONOptionType.php
··· 13 13 $display_value = $request->getStr('value'); 14 14 15 15 if (strlen($display_value)) { 16 - $storage_value = phutil_json_decode($display_value); 17 - if ($storage_value === null) { 16 + try { 17 + $storage_value = phutil_json_decode($display_value); 18 + $this->validateOption($option, $storage_value); 19 + } catch (Exception $ex) { 18 20 $e_value = pht('Invalid'); 19 - $errors[] = pht( 20 - 'Configuration value should be specified in JSON. The provided '. 21 - 'value is not valid JSON.'); 22 - } else { 23 - try { 24 - $this->validateOption($option, $storage_value); 25 - } catch (Exception $ex) { 26 - $e_value = pht('Invalid'); 27 - $errors[] = $ex->getMessage(); 28 - } 21 + $errors[] = $ex->getMessage(); 29 22 } 30 23 } else { 31 24 $storage_value = null;
+1 -4
src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeTabs.php
··· 38 38 $config = $panel->getProperty('config'); 39 39 if (!is_array($config)) { 40 40 // NOTE: The older version of this panel stored raw JSON. 41 - $config = phutil_json_decode($config, null); 42 - if ($config === null) { 43 - throw new Exception(pht('The configuration is not valid JSON.')); 44 - } 41 + $config = phutil_json_decode($config); 45 42 } 46 43 47 44 $list = id(new PHUIListView())
+5 -1
src/applications/differential/customfield/DifferentialAuditorsField.php
··· 20 20 } 21 21 22 22 public function setValueFromStorage($value) { 23 - $this->setValue(phutil_json_decode($value)); 23 + try { 24 + $this->setValue(phutil_json_decode($value)); 25 + } catch (PhutilJSONParserException $ex) { 26 + $this->setValue(array()); 27 + } 24 28 return $this; 25 29 } 26 30
+5 -1
src/applications/differential/customfield/DifferentialJIRAIssuesField.php
··· 26 26 } 27 27 28 28 public function setValueFromStorage($value) { 29 - $this->setValue(phutil_json_decode($value)); 29 + try { 30 + $this->setValue(phutil_json_decode($value)); 31 + } catch (PhutilJSONParserException $ex) { 32 + $this->setValue(array()); 33 + } 30 34 return $this; 31 35 } 32 36
+3 -10
src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php
··· 23 23 } 24 24 25 25 list($message, $fields, $output, $errors) = $parts; 26 - $fields = phutil_json_decode($fields, null); 27 - $output = phutil_json_decode($output, null); 28 - $errors = phutil_json_decode($errors, null); 29 - 30 - if ($fields === null || $output === null || $errors === null) { 31 - throw new Exception( 32 - pht( 33 - 'Expected test file "%s" to contain valid JSON in its sections.', 34 - $file)); 35 - } 26 + $fields = phutil_json_decode($fields); 27 + $output = phutil_json_decode($output); 28 + $errors = phutil_json_decode($errors); 36 29 37 30 $parser = id(new DifferentialCommitMessageParser()) 38 31 ->setLabelMap($fields)