From: Pierre Rudloff Date: Tue, 19 Dec 2017 10:37:55 +0000 (+0100) Subject: Throw NotFoundException if results are empty in api_users_lookup X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;ds=sidebyside;h=a817a1a070b4530eaeb07c90608e289e451c755b;p=friendica.git Throw NotFoundException if results are empty in api_users_lookup --- diff --git a/include/api.php b/include/api.php index ced1f1cbb8..6201b460a3 100644 --- a/include/api.php +++ b/include/api.php @@ -1494,16 +1494,24 @@ api_register_func('api/users/search', 'api_users_search'); * * @return array|string * @throws UnauthorizedException + * @throws NotFoundException */ function api_users_lookup($type) { $users = array(); - foreach (explode(',', $_REQUEST['user_id']) as $id) { - if (!empty($id)) { - $users[] = api_get_user(get_app(), $id); + + if (x($_REQUEST['user_id'])) { + foreach (explode(',', $_REQUEST['user_id']) as $id) { + if (!empty($id)) { + $users[] = api_get_user(get_app(), $id); + } } } + if (empty($users)) { + throw new NotFoundException; + } + return api_format_data("users", $type, array('users' => $users)); }