Issues (2963)

includes/polling/storage/hrstorage.inc.php (1 issue)

1
<?php
2
3
// HOST-RESOURCES-MIB - Storage Objects
4
if (! is_array($storage_cache['hrstorage'])) {
5
    $storage_cache['hrstorage'] = snmpwalk_cache_oid($device, 'hrStorageEntry', null, 'HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES');
0 ignored issues
show
Are you sure the assignment to $storage_cache['hrstorage'] is correct as snmpwalk_cache_oid($devi...:HOST-RESOURCES-TYPES') seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
6
    d_echo($storage_cache);
7
}
8
9
$entry = $storage_cache['hrstorage'][$storage['storage_index']];
10
11
$storage['units'] = $entry['hrStorageAllocationUnits'];
12
$entry['hrStorageUsed'] = fix_integer_value($entry['hrStorageUsed']);
13
$entry['hrStorageSize'] = fix_integer_value($entry['hrStorageSize']);
14
$storage['used'] = ($entry['hrStorageUsed'] * $storage['units']);
15
$storage['size'] = ($entry['hrStorageSize'] * $storage['units']);
16
$storage['free'] = ($storage['size'] - $storage['used']);
17