Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14776257
D12678.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D12678.id.diff
View Options
diff --git a/src/lint/linter/ArcanistJSHintLinter.php b/src/lint/linter/ArcanistJSHintLinter.php
--- a/src/lint/linter/ArcanistJSHintLinter.php
+++ b/src/lint/linter/ArcanistJSHintLinter.php
@@ -132,14 +132,14 @@
}
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
- $errors = json_decode($stdout, true);
-
- if (!is_array($errors)) {
+ $errors = null;
+ try {
+ $error = phutil_json_decode($stdout);
+ } catch (PhutilJSONParserException $ex) {
// Something went wrong and we can't decode the output. Exit abnormally.
- throw new RuntimeException(
- "JSHint returned unparseable output.\n".
- "stdout:\n\n{$stdout}".
- "stderr:\n\n{$stderr}");
+ throw new PhutilProxyException(
+ pht('JSHint returned unparseable output.'),
+ $ex);
}
$messages = array();
diff --git a/src/unit/parser/ArcanistPhpunitTestResultParser.php b/src/unit/parser/ArcanistPhpunitTestResultParser.php
--- a/src/unit/parser/ArcanistPhpunitTestResultParser.php
+++ b/src/unit/parser/ArcanistPhpunitTestResultParser.php
@@ -172,12 +172,7 @@
$json = preg_replace('/}{\s*"/', '},{"', $json);
$json = '['.$json.']';
- $json = json_decode($json);
- if (!is_array($json)) {
- throw new Exception('JSON could not be decoded');
- }
-
- return $json;
+ return phutil_json_decode($json);
}
}
diff --git a/src/workflow/ArcanistCallConduitWorkflow.php b/src/workflow/ArcanistCallConduitWorkflow.php
--- a/src/workflow/ArcanistCallConduitWorkflow.php
+++ b/src/workflow/ArcanistCallConduitWorkflow.php
@@ -67,8 +67,9 @@
pht('Waiting for JSON parameters on stdin...'));
}
$params = @file_get_contents('php://stdin');
- $params = json_decode($params, true);
- if (!is_array($params)) {
+ try {
+ $params = phutil_json_decode($params);
+ } catch (PhutilJSONParserException $ex) {
throw new ArcanistUsageException(
pht('Provide method parameters on stdin as a JSON blob.'));
}
diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php
--- a/src/workflow/ArcanistWorkflow.php
+++ b/src/workflow/ArcanistWorkflow.php
@@ -1405,7 +1405,7 @@
if (!$file) {
return array();
}
- return json_decode($file, true);
+ return phutil_json_decode($file);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 25, 3:55 AM (16 h, 19 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7046478
Default Alt Text
D12678.id.diff (2 KB)
Attached To
Mode
D12678: Use phutil_json_decode instead of json_decode
Attached
Detach File
Event Timeline
Log In to Comment