Issues (2963)

includes/polling/os/poweralert.inc.php (1 issue)

1
<?php
2
3
// .1.3.6.1.2.1.33.1.1.2.0 = STRING: "TRIPP LITE PDUMH20HVATNET"
4
// .1.3.6.1.2.1.33.1.1.4.0 = STRING: "12.04.0052"
5
// .1.3.6.1.2.1.33.1.1.5.0 = STRING: "sysname.company.com"
6
// .1.3.6.1.4.1.850.100.1.1.4.0 = STRING: "9942AY0AC796000912"
7
// .1.3.6.1.4.1.850.10.2.2.1.12.1 = STRING: "This Is My Location"
8
$hardware = snmp_get($device, 'upsIdentModel.0', '-Ovq', 'UPS-MIB');
9
$hardware = preg_split('/TRIPP\ LITE/', $hardware);
0 ignored issues
show
It seems like $hardware can also be of type false; however, parameter $subject of preg_split() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

9
$hardware = preg_split('/TRIPP\ LITE/', /** @scrutinizer ignore-type */ $hardware);
Loading history...
10
$hardware = $hardware[1];
11
$location = trim(snmp_get($device, '.1.3.6.1.4.1.850.10.2.2.1.12.1', '-Ovq', 'TRIPPLITE-MIB'), '"');
12
$sysName = trim(snmp_get($device, '.1.3.6.1.2.1.33.1.1.5.0', '-Ovq', 'TRIPPLITE-MIB'), '"');
13
$serial = trim(snmp_get($device, '.1.3.6.1.4.1.850.100.1.1.4.0', '-Ovq', 'TRIPPLITE-MIB'), '"');
14
$version = snmp_get($device, 'upsIdentAgentSoftwareVersion.0', '-Ovq', 'UPS-MIB');
15