These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Grants admin privileges to a user. |
||
4 | */ |
||
5 | |||
6 | $guid = get_input('guid'); |
||
7 | $user = get_user($guid); |
||
8 | |||
9 | if (!$user || !$user->canEdit()) { |
||
1 ignored issue
–
show
|
|||
10 | return elgg_error_response(elgg_echo('admin:user:makeadmin:no')); |
||
11 | } |
||
12 | |||
13 | if (!$user->makeAdmin()) { |
||
14 | return elgg_error_response(elgg_echo('admin:user:makeadmin:no')); |
||
15 | } |
||
16 | |||
17 | return elgg_ok_response('', elgg_echo('admin:user:makeadmin:yes')); |
||
18 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: