Page MenuHomePhabricator

D20235.diff
No OneTemporary

D20235.diff

diff --git a/src/aphront/configuration/AphrontApplicationConfiguration.php b/src/aphront/configuration/AphrontApplicationConfiguration.php
--- a/src/aphront/configuration/AphrontApplicationConfiguration.php
+++ b/src/aphront/configuration/AphrontApplicationConfiguration.php
@@ -776,7 +776,6 @@
'filler' => str_repeat('Q', 1024 * 16),
);
-
return id(new AphrontJSONResponse())
->setAddJSONShield(false)
->setContent($result);
diff --git a/src/applications/config/check/PhabricatorWebServerSetupCheck.php b/src/applications/config/check/PhabricatorWebServerSetupCheck.php
--- a/src/applications/config/check/PhabricatorWebServerSetupCheck.php
+++ b/src/applications/config/check/PhabricatorWebServerSetupCheck.php
@@ -129,30 +129,16 @@
}
$structure = null;
- $caught = null;
$extra_whitespace = ($body !== trim($body));
- if (!$extra_whitespace) {
- try {
- $structure = phutil_json_decode($body);
- } catch (Exception $ex) {
- $caught = $ex;
- }
+ try {
+ $structure = phutil_json_decode(trim($body));
+ } catch (Exception $ex) {
+ // Ignore the exception, we only care if the decode worked or not.
}
- if (!$structure) {
- if ($extra_whitespace) {
- $message = pht(
- 'Phabricator sent itself a test request and expected to get a bare '.
- 'JSON response back, but the response had extra whitespace at '.
- 'the beginning or end.'.
- "\n\n".
- 'This usually means you have edited a file and left whitespace '.
- 'characters before the opening %s tag, or after a closing %s tag. '.
- 'Remove any leading whitespace, and prefer to omit closing tags.',
- phutil_tag('tt', array(), '<?php'),
- phutil_tag('tt', array(), '?>'));
- } else {
+ if (!$structure || $extra_whitespace) {
+ if (!$structure) {
$short = id(new PhutilUTF8StringTruncator())
->setMaximumGlyphs(1024)
->truncateString($body);
@@ -166,6 +152,17 @@
"\n\n".
'Something is misconfigured or otherwise mangling responses.',
phutil_tag('pre', array(), $short));
+ } else {
+ $message = pht(
+ 'Phabricator sent itself a test request and expected to get a bare '.
+ 'JSON response back. It received a JSON response, but the response '.
+ 'had extra whitespace at the beginning or end.'.
+ "\n\n".
+ 'This usually means you have edited a file and left whitespace '.
+ 'characters before the opening %s tag, or after a closing %s tag. '.
+ 'Remove any leading whitespace, and prefer to omit closing tags.',
+ phutil_tag('tt', array(), '<?php'),
+ phutil_tag('tt', array(), '?>'));
}
$this->newIssue('webserver.mangle')
@@ -174,7 +171,9 @@
->setMessage($message);
// We can't run the other checks if we could not decode the response.
- return;
+ if (!$structure) {
+ return;
+ }
}
$actual_user = idx($structure, 'user');

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 26, 12:28 PM (1 w, 12 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7693108
Default Alt Text
D20235.diff (3 KB)

Event Timeline