Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F19060474
D17917.id43100.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D17917.id43100.diff
View Options
diff --git a/src/infrastructure/env/PhabricatorConfigLocalSource.php b/src/infrastructure/env/PhabricatorConfigLocalSource.php
--- a/src/infrastructure/env/PhabricatorConfigLocalSource.php
+++ b/src/infrastructure/env/PhabricatorConfigLocalSource.php
@@ -21,17 +21,36 @@
private function loadConfig() {
$path = $this->getConfigPath();
- if (@file_exists($path)) {
- $data = @file_get_contents($path);
- if ($data) {
- $data = json_decode($data, true);
- if (is_array($data)) {
- return $data;
- }
- }
+
+ if (!Filesystem::pathExists($path)) {
+ return array();
+ }
+
+ try {
+ $data = Filesystem::readFile($path);
+ } catch (FilesystemException $ex) {
+ throw new PhutilProxyException(
+ pht(
+ 'Configuration file "%s" exists, but could not be read. It may '.
+ 'have permissions which are too restrictive.',
+ $path),
+ $ex);
}
- return array();
+ try {
+ $result = phutil_json_decode($data);
+ } catch (PhutilJSONParserException $ex) {
+ throw new PhutilProxyException(
+ pht(
+ 'Configuration file "%s" exists and is readable, but the content '.
+ 'is not valid JSON. You may have edited this file manually and '.
+ 'introduced a syntax error by mistake. Correct the file syntax '.
+ 'to continue.',
+ $path),
+ $ex);
+ }
+
+ return $result;
}
private function saveConfig() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Nov 30 2025, 9:22 AM (6 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8777731
Default Alt Text
D17917.id43100.diff (1 KB)
Attached To
Mode
D17917: Throw an exception if `local.json` can't be read
Attached
Detach File
Event Timeline
Log In to Comment