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

When an invalid "constraints" parameter is provided to a "*.search" method, raise a more tailored error

Summary:
See <https://discourse.phabricator-community.org/t/constraints-parameter-type-handling-in-maniphest-search/2636>.

(The caller provided `constraints={...}` via cURL, but you can't mix JSON and HTTP parameters like that.)

Test Plan: Called `curl 'http://local.phacility.com/api/maniphest.search?api.token=...&constraints=X'` (with a valid API token), got a more sensible error.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D20429
This commit is contained in:
epriestley 2019-04-15 11:48:07 -07:00
parent 23b86bae6c
commit 382e2c32fc

View file

@ -1142,6 +1142,12 @@ abstract class PhabricatorApplicationSearchEngine extends Phobject {
}
$constraints = $request->getValue('constraints', array());
if (!is_array($constraints)) {
throw new Exception(
pht(
'Parameter "constraints" must be a map of constraints, got "%s".',
phutil_describe_type($constraints)));
}
$fields = $this->getSearchFieldsForConduit();