diff --git a/src/applications/conduit/controller/PhabricatorConduitAPIController.php b/src/applications/conduit/controller/PhabricatorConduitAPIController.php index 21cca29a0b..7b9ea60e56 100644 --- a/src/applications/conduit/controller/PhabricatorConduitAPIController.php +++ b/src/applications/conduit/controller/PhabricatorConduitAPIController.php @@ -451,7 +451,18 @@ final class PhabricatorConduitAPIController $params_json = $request->getStr('params'); if (!strlen($params_json)) { - $params = array(); + if ($request->getBool('allowEmptyParams')) { + // TODO: This is a bit messy, but otherwise you can't call + // "conduit.ping" from the web console. + $params = array(); + } else { + throw new Exception( + "Request has no 'params' key. This may mean that an extension like ". + "Suhosin has dropped data from the request. Check the PHP ". + "configuration on your server. If you are developing a Conduit ". + "client, you MUST provide a 'params' parameter when making a ". + "Conduit request, even if the value is empty (e.g., provide '{}')."); + } } else { $params = json_decode($params_json, true); if (!is_array($params)) { diff --git a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php index e8bcc28592..3d0f2c41a0 100644 --- a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php +++ b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php @@ -74,6 +74,7 @@ final class PhabricatorConduitConsoleController $form ->setUser($request->getUser()) ->setAction('/api/'.$this->method) + ->addHiddenInput('allowEmptyParams', 1) ->appendChild( id(new AphrontFormStaticControl()) ->setLabel('Description')