Checks whether a method/function call has too few arguments.
1 | <?php |
||
2 | /** |
||
3 | * Memcache info |
||
4 | */ |
||
5 | $servers = elgg_get_config('memcache_servers'); |
||
6 | $has_class = class_exists('Memcached') || class_exists('Memcache'); |
||
7 | if (!elgg_get_config('memcache') || empty($servers) || !$has_class) { |
||
8 | echo '<p>' . elgg_echo('admin:server:memcache:inactive') . '</p>'; |
||
9 | return; |
||
10 | } |
||
11 | |||
12 | if (class_exists('Memcached')) { |
||
13 | $memcache = new Memcached(); |
||
14 | } else { |
||
15 | $memcache = new Memcache(); |
||
16 | } |
||
17 | foreach ($servers as $server) { |
||
18 | $title = "{$server[0]}:{$server[1]}"; |
||
19 | |||
20 | $memcache->connect($server[0], $server[1]); |
||
21 | $stats = $memcache->getStats(); |
||
0 ignored issues
–
show
|
|||
22 | $memcache->close(); |
||
23 | |||
24 | ob_start(); |
||
25 | ?> |
||
26 | <table class="elgg-table-alt"> |
||
27 | <?php |
||
28 | foreach ($stats as $key => $value) { |
||
29 | ?> |
||
30 | <tr> |
||
31 | <td><b><?= $key ?></b></td> |
||
32 | <td><?= $value ?></td> |
||
33 | </tr> |
||
34 | <?php |
||
35 | } |
||
36 | ?> |
||
37 | </table> |
||
38 | |||
39 | <?php |
||
40 | $table = ob_get_clean(); |
||
41 | |||
42 | echo elgg_view_module('info', $title, $table); |
||
43 | } |
||
44 |
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.