Skip to content

Commit

Permalink
Extension.get API - Only apply special filters once (key/keys/full_name)
Browse files Browse the repository at this point in the history
Filtering extensions by key is a good idea -- so good we have three ways to do it! ;)

All of these fields accept a `string|array<string>` input, which is different from
the typical filtering supported by `_civicrm_api3_basic_array_get()` (which only
matches on values)...  If you happen to choose a basic filter that passes both
filters (i.e.  a simple string-match), then it works.  But if you choose a filter
where they behave differnetly (i.e.  an array), then you get weird results.
  • Loading branch information
totten committed Feb 22, 2018
1 parent f9884e0 commit 7f854b8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion api/v3/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,13 @@ function civicrm_api3_extension_get($params) {
$result[] = $info;
}
}
$filterableFields = array('id', 'key', 'type', 'status', 'path');

// These fields have been filtered already, and they have special semantics.
unset($params['key']);
unset($params['keys']);
unset($params['full_name']);

$filterableFields = array('id', 'type', 'status', 'path');
return _civicrm_api3_basic_array_get('Extension', $params, $result, 'id', $filterableFields);
}

Expand Down

0 comments on commit 7f854b8

Please sign in to comment.