Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15426325
D12680.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
26 KB
Referenced Files
None
Subscribers
None
D12680.id.diff
View Options
diff --git a/scripts/celerity/generate_sprites.php b/scripts/celerity/generate_sprites.php
--- a/scripts/celerity/generate_sprites.php
+++ b/scripts/celerity/generate_sprites.php
@@ -53,7 +53,7 @@
if (!$args->getArg('force')) {
if (Filesystem::pathExists($manifest_path)) {
$data = Filesystem::readFile($manifest_path);
- $data = json_decode($data, true);
+ $data = phutil_json_decode($data);
if (!$sheet->needsRegeneration($data)) {
continue;
}
diff --git a/src/applications/conduit/controller/PhabricatorConduitAPIController.php b/src/applications/conduit/controller/PhabricatorConduitAPIController.php
--- a/src/applications/conduit/controller/PhabricatorConduitAPIController.php
+++ b/src/applications/conduit/controller/PhabricatorConduitAPIController.php
@@ -647,12 +647,15 @@
// entire param dictionary JSON encoded.
$params_json = $request->getStr('params');
if (strlen($params_json)) {
- $params = json_decode($params_json, true);
- if (!is_array($params)) {
- throw new Exception(
- "Invalid parameter information was passed to method ".
- "'{$method}', could not decode JSON serialization. Data: ".
- $params_json);
+ $params = null;
+ try {
+ $params = phutil_json_decode($params_json);
+ } catch (PhutilJSONParserException $ex) {
+ throw new PhutilProxyException(
+ pht(
+ "Invalid parameter information was passed to method '%s'",
+ $method),
+ $ex);
}
$metadata = idx($params, '__conduit__', array());
diff --git a/src/applications/conduit/ssh/ConduitSSHWorkflow.php b/src/applications/conduit/ssh/ConduitSSHWorkflow.php
--- a/src/applications/conduit/ssh/ConduitSSHWorkflow.php
+++ b/src/applications/conduit/ssh/ConduitSSHWorkflow.php
@@ -26,13 +26,17 @@
$method = head($methodv);
$json = $this->readAllInput();
- $raw_params = json_decode($json, true);
- if (!is_array($raw_params)) {
- throw new Exception('Invalid JSON input.');
+ $raw_params = null;
+ try {
+ $raw_params = phutil_json_decode($json);
+ } catch (PhutilJSONParserException $ex) {
+ throw new PhutilProxyException(
+ pht('Invalid JSON input.'),
+ $ex);
}
$params = idx($raw_params, 'params', '[]');
- $params = json_decode($params, true);
+ $params = phutil_json_decode($params);
$metadata = idx($params, '__conduit__', array());
unset($params['__conduit__']);
diff --git a/src/applications/console/controller/DarkConsoleDataController.php b/src/applications/console/controller/DarkConsoleDataController.php
--- a/src/applications/console/controller/DarkConsoleDataController.php
+++ b/src/applications/console/controller/DarkConsoleDataController.php
@@ -33,9 +33,9 @@
return new Aphront400Response();
}
- $result = json_decode($result, true);
-
- if (!is_array($result)) {
+ try {
+ $result = phutil_json_decode($result);
+ } catch (PhutilJSONParserException $ex) {
return new Aphront400Response();
}
diff --git a/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php b/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php
--- a/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php
+++ b/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php
@@ -17,9 +17,12 @@
$opt_file = $dir.$file.'.options';
if (Filesystem::pathExists($opt_file)) {
$options = Filesystem::readFile($opt_file);
- $options = json_decode($options, true);
- if (!is_array($options)) {
- throw new Exception("Invalid options file: {$opt_file}.");
+ try {
+ $options = phutil_json_decode($options);
+ } catch (PhutilJSONParserException $ex) {
+ throw new PhutilProxyException(
+ pht('Invalid options file: %s.', $opt_file),
+ $ex);
}
} else {
$options = array();
diff --git a/src/applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php
--- a/src/applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php
@@ -86,7 +86,7 @@
protected function execute(ConduitAPIRequest $request) {
$diff_id = $request->getValue('diff_id');
$name = $request->getValue('name');
- $data = json_decode($request->getValue('data'), true);
+ $data = phutil_json_decode($request->getValue('data'));
self::updateDiffProperty($diff_id, $name, $data);
diff --git a/src/applications/diffusion/DiffusionLintSaveRunner.php b/src/applications/diffusion/DiffusionLintSaveRunner.php
--- a/src/applications/diffusion/DiffusionLintSaveRunner.php
+++ b/src/applications/diffusion/DiffusionLintSaveRunner.php
@@ -154,9 +154,11 @@
$files);
foreach (new LinesOfALargeExecFuture($future) as $json) {
- $paths = json_decode($json, true);
- if (!is_array($paths)) {
- fprintf(STDERR, "Invalid JSON: {$json}\n");
+ $paths = null;
+ try {
+ $paths = phutil_json_decode($json);
+ } catch (PhutilJSONParserException $ex) {
+ fprintf(STDERR, pht("Invalid JSON: %s\n", $json));
continue;
}
diff --git a/src/applications/diffusion/controller/DiffusionLastModifiedController.php b/src/applications/diffusion/controller/DiffusionLastModifiedController.php
--- a/src/applications/diffusion/controller/DiffusionLastModifiedController.php
+++ b/src/applications/diffusion/controller/DiffusionLastModifiedController.php
@@ -11,8 +11,9 @@
$viewer = $request->getUser();
$paths = $request->getStr('paths');
- $paths = json_decode($paths, true);
- if (!is_array($paths)) {
+ try {
+ $paths = phutil_json_decode($paths);
+ } catch (PhutilJSONParserException $ex) {
return new Aphront400Response();
}
diff --git a/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php b/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php
--- a/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php
+++ b/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php
@@ -9,7 +9,7 @@
$raw = Filesystem::readFile($data.$file);
$raw = explode("\n~~~~~~~~~~\n", $raw, 2);
$this->assertEqual(2, count($raw));
- $expect = json_decode($raw[1], true);
+ $expect = phutil_json_decode($raw[1]);
$this->assertTrue(is_array($expect), $file);
$this->assertParserResult($expect, $raw[0], $file);
diff --git a/src/applications/doorkeeper/controller/DoorkeeperTagsController.php b/src/applications/doorkeeper/controller/DoorkeeperTagsController.php
--- a/src/applications/doorkeeper/controller/DoorkeeperTagsController.php
+++ b/src/applications/doorkeeper/controller/DoorkeeperTagsController.php
@@ -7,8 +7,9 @@
$viewer = $request->getUser();
$tags = $request->getStr('tags');
- $tags = json_decode($tags, true);
- if (!is_array($tags)) {
+ try {
+ $tags = phutil_json_decode($tags);
+ } catch (PhutilJSONParserException $ex) {
$tags = array();
}
diff --git a/src/applications/help/controller/PhabricatorHelpKeyboardShortcutController.php b/src/applications/help/controller/PhabricatorHelpKeyboardShortcutController.php
--- a/src/applications/help/controller/PhabricatorHelpKeyboardShortcutController.php
+++ b/src/applications/help/controller/PhabricatorHelpKeyboardShortcutController.php
@@ -12,8 +12,9 @@
$user = $request->getUser();
$keys = $request->getStr('keys');
- $keys = json_decode($keys, true);
- if (!is_array($keys)) {
+ try {
+ $keys = phutil_json_decode($keys);
+ } catch (PhutilJSONParserException $ex) {
return new Aphront400Response();
}
diff --git a/src/applications/herald/adapter/HeraldAdapter.php b/src/applications/herald/adapter/HeraldAdapter.php
--- a/src/applications/herald/adapter/HeraldAdapter.php
+++ b/src/applications/herald/adapter/HeraldAdapter.php
@@ -633,14 +633,16 @@
// dictionary. The first regexp must match the dictionary key, and the
// second regexp must match the dictionary value. If any key/value pair
// in the dictionary matches both regexps, the condition is satisfied.
- $regexp_pair = json_decode($condition_value, true);
- if (!is_array($regexp_pair)) {
+ $regexp_pair = null;
+ try {
+ $regexp_pair = phutil_json_decode($condition_value);
+ } catch (PhutilJSONParserException $ex) {
throw new HeraldInvalidConditionException(
- 'Regular expression pair is not valid JSON!');
+ pht('Regular expression pair is not valid JSON!'));
}
if (count($regexp_pair) != 2) {
throw new HeraldInvalidConditionException(
- 'Regular expression pair is not a pair!');
+ pht('Regular expression pair is not a pair!'));
}
$key_regexp = array_shift($regexp_pair);
@@ -705,8 +707,10 @@
}
break;
case self::CONDITION_REGEXP_PAIR:
- $json = json_decode($condition_value, true);
- if (!is_array($json)) {
+ $json = null;
+ try {
+ $json = phutil_json_decode($condition_value);
+ } catch (PhutilJSONParserException $ex) {
throw new HeraldInvalidConditionException(
pht(
'The regular expression pair "%s" is not valid JSON. Enter a '.
diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php
--- a/src/applications/herald/controller/HeraldRuleController.php
+++ b/src/applications/herald/controller/HeraldRuleController.php
@@ -258,7 +258,15 @@
$errors[] = pht('Rule must have a name.');
}
- $data = json_decode($request->getStr('rule'), true);
+ $data = null;
+ try {
+ $data = phutil_json_decode($request->getStr('rule'));
+ } catch (PhutilJSONParserException $ex) {
+ throw new PhutilProxyException(
+ pht('Failed to decode rule data.'),
+ $ex);
+ }
+
if (!is_array($data) ||
!$data['conditions'] ||
!$data['actions']) {
diff --git a/src/applications/maniphest/controller/ManiphestBatchEditController.php b/src/applications/maniphest/controller/ManiphestBatchEditController.php
--- a/src/applications/maniphest/controller/ManiphestBatchEditController.php
+++ b/src/applications/maniphest/controller/ManiphestBatchEditController.php
@@ -47,7 +47,7 @@
$actions = $request->getStr('actions');
if ($actions) {
- $actions = json_decode($actions, true);
+ $actions = phutil_json_decode($actions);
}
if ($request->isFormPost() && is_array($actions)) {
diff --git a/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php b/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php
--- a/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php
+++ b/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php
@@ -74,7 +74,7 @@
break;
case PhabricatorTransactions::TYPE_EDGE:
if ($value) {
- $value = json_decode($value);
+ $value = phutil_json_decode($value);
}
if (!$value) {
$value = array();
diff --git a/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php b/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php
--- a/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php
+++ b/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php
@@ -120,9 +120,13 @@
list($body) = $future->resolvex();
- $response = json_decode($body, true);
- if (!is_array($response)) {
- throw new Exception("Failed to JSON decode response: {$body}");
+ $response = null;
+ try {
+ $response = phutil_json_decode($body);
+ } catch (PhutilJSONParserException $ex) {
+ throw new PhutilProxyException(
+ pht('Failed to JSON decode response.'),
+ $ex);
}
if (!idx($response, 'id')) {
diff --git a/src/applications/metamta/adapter/PhabricatorMailImplementationSendGridAdapter.php b/src/applications/metamta/adapter/PhabricatorMailImplementationSendGridAdapter.php
--- a/src/applications/metamta/adapter/PhabricatorMailImplementationSendGridAdapter.php
+++ b/src/applications/metamta/adapter/PhabricatorMailImplementationSendGridAdapter.php
@@ -78,8 +78,10 @@
if (!$user || !$key) {
throw new Exception(
- "Configure 'sendgrid.api-user' and 'sendgrid.api-key' to use ".
- "SendGrid for mail delivery.");
+ pht(
+ "Configure '%s' and '%s' to use SendGrid for mail delivery.",
+ 'sendgrid.api-user',
+ 'sendgrid.api-key'));
}
$params = array();
@@ -142,14 +144,18 @@
list($body) = $future->resolvex();
- $response = json_decode($body, true);
- if (!is_array($response)) {
- throw new Exception("Failed to JSON decode response: {$body}");
+ $response = null;
+ try {
+ $response = phutil_json_decode($body);
+ } catch (PhutilJSONParserException $ex) {
+ throw new PhutilProxyException(
+ pht('Failed to JSON decode response.'),
+ $ex);
}
if ($response['message'] !== 'success') {
$errors = implode(';', $response['errors']);
- throw new Exception("Request failed with errors: {$errors}.");
+ throw new Exception(pht('Request failed with errors: %s.', $errors));
}
return true;
diff --git a/src/applications/metamta/contentsource/PhabricatorContentSource.php b/src/applications/metamta/contentsource/PhabricatorContentSource.php
--- a/src/applications/metamta/contentsource/PhabricatorContentSource.php
+++ b/src/applications/metamta/contentsource/PhabricatorContentSource.php
@@ -32,7 +32,7 @@
}
public static function newFromSerialized($serialized) {
- $dict = json_decode($serialized, true);
+ $dict = phutil_json_decode($serialized);
if (!is_array($dict)) {
$dict = array();
}
diff --git a/src/applications/phame/skins/PhameSkinSpecification.php b/src/applications/phame/skins/PhameSkinSpecification.php
--- a/src/applications/phame/skins/PhameSkinSpecification.php
+++ b/src/applications/phame/skins/PhameSkinSpecification.php
@@ -93,15 +93,18 @@
}
private static function loadSkinSpecification($path) {
-
$config_path = $path.DIRECTORY_SEPARATOR.'skin.json';
$config = array();
if (Filesystem::pathExists($config_path)) {
$config = Filesystem::readFile($config_path);
- $config = json_decode($config, true);
- if (!is_array($config)) {
- throw new Exception(
- "Skin configuration file '{$config_path}' is not a valid JSON file.");
+ try {
+ $config = phutil_json_decode($config);
+ } catch (PhutilJSONParserException $ex) {
+ throw new PhutilProxyException(
+ pht(
+ "Skin configuration file '%s' is not a valid JSON file.",
+ $config_path),
+ $ex);
}
$type = idx($config, 'type', self::TYPE_BASIC);
} else {
diff --git a/src/applications/phortune/controller/PhortunePaymentMethodCreateController.php b/src/applications/phortune/controller/PhortunePaymentMethodCreateController.php
--- a/src/applications/phortune/controller/PhortunePaymentMethodCreateController.php
+++ b/src/applications/phortune/controller/PhortunePaymentMethodCreateController.php
@@ -94,20 +94,23 @@
if (!$errors) {
$client_token_raw = $request->getStr('token');
- $client_token = json_decode($client_token_raw, true);
- if (!is_array($client_token)) {
+ $client_token = null;
+ try {
+ $client_token = phutil_json_decode($client_token_raw);
+ } catch (PhutilJSONParserException $ex) {
$errors[] = pht(
'There was an error decoding token information submitted by the '.
'client. Expected a JSON-encoded token dictionary, received: %s.',
nonempty($client_token_raw, pht('nothing')));
- } else {
- if (!$provider->validateCreatePaymentMethodToken($client_token)) {
- $errors[] = pht(
- 'There was an error with the payment token submitted by the '.
- 'client. Expected a valid dictionary, received: %s.',
- $client_token_raw);
- }
}
+
+ if (!$provider->validateCreatePaymentMethodToken($client_token)) {
+ $errors[] = pht(
+ 'There was an error with the payment token submitted by the '.
+ 'client. Expected a valid dictionary, received: %s.',
+ $client_token_raw);
+ }
+
if (!$errors) {
$errors = $provider->createPaymentMethodFromRequest(
$request,
@@ -215,8 +218,10 @@
$errors = array();
- $client_errors = json_decode($client_errors_raw, true);
- if (!is_array($client_errors)) {
+ $client_errors = null;
+ try {
+ $client_errors = phutil_json_decode($client_errors_raw);
+ } catch (PhutilJSONParserException $ex) {
$errors[] = pht(
'There was an error decoding error information submitted by the '.
'client. Expected a JSON-encoded list of error codes, received: %s.',
diff --git a/src/applications/policy/controller/PhabricatorPolicyEditController.php b/src/applications/policy/controller/PhabricatorPolicyEditController.php
--- a/src/applications/policy/controller/PhabricatorPolicyEditController.php
+++ b/src/applications/policy/controller/PhabricatorPolicyEditController.php
@@ -52,9 +52,12 @@
$errors = array();
if ($request->isFormPost()) {
$data = $request->getStr('rules');
- $data = @json_decode($data, true);
- if (!is_array($data)) {
- throw new Exception('Failed to JSON decode rule data!');
+ try {
+ $data = phutil_json_decode($data);
+ } catch (PhutilJSONParserException $ex) {
+ throw new PhutilProxyException(
+ pht('Failed to JSON decode rule data!'),
+ $ex);
}
$rule_data = array();
diff --git a/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php b/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php
--- a/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php
+++ b/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php
@@ -39,7 +39,7 @@
public function setValueFromStorage($json) {
if ($json) {
- $dict = json_decode($json, true);
+ $dict = phutil_json_decode($json);
$this->releephAction = idx($dict, 'releephAction');
$this->releephPHIDs = idx($dict, 'releephPHIDs');
}
diff --git a/src/applications/search/engine/PhabricatorElasticSearchEngine.php b/src/applications/search/engine/PhabricatorElasticSearchEngine.php
--- a/src/applications/search/engine/PhabricatorElasticSearchEngine.php
+++ b/src/applications/search/engine/PhabricatorElasticSearchEngine.php
@@ -397,12 +397,13 @@
return null;
}
- $body = json_decode($body, true);
- if (!is_array($body)) {
- throw new Exception('elasticsearch server returned invalid JSON!');
+ try {
+ return phutil_json_decode($body);
+ } catch (PhutilJSONParserException $ex) {
+ throw new PhutilProxyException(
+ pht('ElasticSearch server returned invalid JSON!'),
+ $ex);
}
-
- return $body;
}
}
diff --git a/src/applications/xhprof/controller/PhabricatorXHProfProfileController.php b/src/applications/xhprof/controller/PhabricatorXHProfProfileController.php
--- a/src/applications/xhprof/controller/PhabricatorXHProfProfileController.php
+++ b/src/applications/xhprof/controller/PhabricatorXHProfProfileController.php
@@ -21,9 +21,12 @@
}
$data = $file->loadFileData();
- $data = @json_decode($data, true);
- if (!$data) {
- throw new Exception('Failed to unserialize XHProf profile!');
+ try {
+ $data = phutil_json_decode($data);
+ } catch (PhutilJSONParserException $ex) {
+ throw new PhutilProxyException(
+ pht('Failed to unserialize XHProf profile!'),
+ $ex);
}
$symbol = $request->getStr('symbol');
diff --git a/src/infrastructure/customfield/config/PhabricatorCustomFieldConfigOptionType.php b/src/infrastructure/customfield/config/PhabricatorCustomFieldConfigOptionType.php
--- a/src/infrastructure/customfield/config/PhabricatorCustomFieldConfigOptionType.php
+++ b/src/infrastructure/customfield/config/PhabricatorCustomFieldConfigOptionType.php
@@ -11,7 +11,7 @@
$errors = array();
$storage_value = $request->getStr('value');
- $in_value = json_decode($storage_value, true);
+ $in_value = phutil_json_decode($storage_value);
if (!is_array($in_value)) {
$in_value = array();
}
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
@@ -124,7 +124,7 @@
$old = array();
}
- $new = json_decode($xaction->getNewValue());
+ $new = phutil_json_decode($xaction->getNewValue());
if (!is_array($new)) {
$new = array();
}
diff --git a/src/infrastructure/daemon/bot/PhabricatorBot.php b/src/infrastructure/daemon/bot/PhabricatorBot.php
--- a/src/infrastructure/daemon/bot/PhabricatorBot.php
+++ b/src/infrastructure/daemon/bot/PhabricatorBot.php
@@ -23,9 +23,12 @@
}
$json_raw = Filesystem::readFile($argv[0]);
- $config = json_decode($json_raw, true);
- if (!is_array($config)) {
- throw new Exception("File '{$argv[0]}' is not valid JSON!");
+ try {
+ $config = phutil_json_decode($json_raw);
+ } catch (PhutilJSONParserException $ex) {
+ throw new PhutilProxyException(
+ pht("File '%s' is not valid JSON!", $argv[0]),
+ $ex);
}
$nick = idx($config, 'nick', 'phabot');
diff --git a/src/infrastructure/daemon/bot/adapter/PhabricatorBotBaseStreamingProtocolAdapter.php b/src/infrastructure/daemon/bot/adapter/PhabricatorBotBaseStreamingProtocolAdapter.php
--- a/src/infrastructure/daemon/bot/adapter/PhabricatorBotBaseStreamingProtocolAdapter.php
+++ b/src/infrastructure/daemon/bot/adapter/PhabricatorBotBaseStreamingProtocolAdapter.php
@@ -124,7 +124,7 @@
$message = substr($buffer, 0, $until + 1);
$buffer = substr($buffer, $until + 2);
- $m_obj = json_decode($message, true);
+ $m_obj = phutil_json_decode($message);
if ($message = $this->processMessage($m_obj)) {
return $message;
}
@@ -149,7 +149,7 @@
$output = trim($output);
if (strlen($output)) {
- return json_decode($output, true);
+ return phutil_json_decode($output);
}
return true;
@@ -165,6 +165,6 @@
abstract protected function buildStreamingUrl($channel);
- abstract protected function processMessage($raw_object);
+ abstract protected function processMessage(array $raw_object);
}
diff --git a/src/infrastructure/daemon/bot/adapter/PhabricatorBotFlowdockProtocolAdapter.php b/src/infrastructure/daemon/bot/adapter/PhabricatorBotFlowdockProtocolAdapter.php
--- a/src/infrastructure/daemon/bot/adapter/PhabricatorBotFlowdockProtocolAdapter.php
+++ b/src/infrastructure/daemon/bot/adapter/PhabricatorBotFlowdockProtocolAdapter.php
@@ -26,7 +26,7 @@
return $url;
}
- protected function processMessage($m_obj) {
+ protected function processMessage(array $m_obj) {
$command = null;
switch ($m_obj['event']) {
case 'message':
diff --git a/src/infrastructure/daemon/bot/adapter/PhabricatorCampfireProtocolAdapter.php b/src/infrastructure/daemon/bot/adapter/PhabricatorCampfireProtocolAdapter.php
--- a/src/infrastructure/daemon/bot/adapter/PhabricatorCampfireProtocolAdapter.php
+++ b/src/infrastructure/daemon/bot/adapter/PhabricatorCampfireProtocolAdapter.php
@@ -16,7 +16,7 @@
return $url;
}
- protected function processMessage($m_obj) {
+ protected function processMessage(array $m_obj) {
$command = null;
switch ($m_obj['type']) {
case 'TextMessage':
diff --git a/src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php b/src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php
--- a/src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php
+++ b/src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php
@@ -191,7 +191,7 @@
foreach ($data as $row) {
$tasks[$row['id']]->setServerTime($row['_serverTime']);
if ($row['_taskData']) {
- $task_data = json_decode($row['_taskData'], true);
+ $task_data = phutil_json_decode($row['_taskData']);
} else {
$task_data = null;
}
diff --git a/src/infrastructure/edges/query/PhabricatorEdgeQuery.php b/src/infrastructure/edges/query/PhabricatorEdgeQuery.php
--- a/src/infrastructure/edges/query/PhabricatorEdgeQuery.php
+++ b/src/infrastructure/edges/query/PhabricatorEdgeQuery.php
@@ -201,7 +201,7 @@
$data_ids);
foreach ($data_rows as $row) {
$data_map[$row['id']] = idx(
- json_decode($row['data'], true),
+ phutil_json_decode($row['data']),
'data');
}
}
diff --git a/src/infrastructure/storage/lisk/LiskDAO.php b/src/infrastructure/storage/lisk/LiskDAO.php
--- a/src/infrastructure/storage/lisk/LiskDAO.php
+++ b/src/infrastructure/storage/lisk/LiskDAO.php
@@ -1637,7 +1637,7 @@
break;
case self::SERIALIZATION_JSON:
if ($deserialize) {
- $data[$col] = json_decode($data[$col], true);
+ $data[$col] = phutil_json_decode($data[$col]);
} else {
$data[$col] = json_encode($data[$col]);
}
diff --git a/src/view/phui/PHUIIconView.php b/src/view/phui/PHUIIconView.php
--- a/src/view/phui/PHUIIconView.php
+++ b/src/view/phui/PHUIIconView.php
@@ -106,7 +106,7 @@
$root = dirname(phutil_get_library_root('phabricator'));
$path = $root.'/resources/sprite/manifest/'.$sheet.'.json';
$data = Filesystem::readFile($path);
- return idx(json_decode($data, true), 'sprites');
+ return idx(phutil_json_decode($data), 'sprites');
}
public static function getFontIcons() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 24, 8:00 AM (4 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7706967
Default Alt Text
D12680.id.diff (26 KB)
Attached To
Mode
D12680: Use phutil_json_decode instead of json_decode
Attached
Detach File
Event Timeline
Log In to Comment