1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Fix a use of $method in Conduit which is not available in scope

Summary:
This got refactored at some point and lost access to $method. Also make the error a little more helpful.

See https://groups.google.com/forum/?fromgroups=#!topic/phabricator-dev/05voYIPV7uU

Test Plan:
  $ arc list --conduit-uri=http://local.aphront.com:8080/
  Exception
  ERR-CONDUIT-CORE: Invalid parameter information was passed to method 'conduit.connect', could not decode JSON serialization. Data: xxx{"client":"arc","clientVersion":5,"clientDescription":"orbital:\/INSECURE\/devtools\/arcanist\/bin\/..\/scripts\/arcanist.php list --conduit-uri=http:\/\/local.aphront.com:8080\/","user":"epriestley","host":"http:\/\/local.aphront.com:8080\/api\/","authToken":1349367823,"authSignature":"54bc136589c076ea06f8e5fb77c76ea7d57aec5b"}
  (Run with --trace for a full exception trace.)

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D3622
This commit is contained in:
epriestley 2012-10-04 09:30:32 -07:00
parent 4a2bcc06fe
commit 36d02b6c79

View file

@ -47,7 +47,7 @@ final class PhabricatorConduitAPIController
try { try {
$params = $this->decodeConduitParams($request); $params = $this->decodeConduitParams($request, $method);
$metadata = idx($params, '__conduit__', array()); $metadata = idx($params, '__conduit__', array());
unset($params['__conduit__']); unset($params['__conduit__']);
@ -420,7 +420,9 @@ final class PhabricatorConduitAPIController
return $value; return $value;
} }
private function decodeConduitParams(AphrontRequest $request) { private function decodeConduitParams(
AphrontRequest $request,
$method) {
// Look for parameters from the Conduit API Console, which are encoded // Look for parameters from the Conduit API Console, which are encoded
// as HTTP POST parameters in an array, e.g.: // as HTTP POST parameters in an array, e.g.:
@ -471,7 +473,8 @@ final class PhabricatorConduitAPIController
if (!is_array($params)) { if (!is_array($params)) {
throw new Exception( throw new Exception(
"Invalid parameter information was passed to method ". "Invalid parameter information was passed to method ".
"'{$method}', could not decode JSON serialization."); "'{$method}', could not decode JSON serialization. Data: ".
$params_json);
} }
} }