fix: snmp_get_multi returns no data if the oid doesn't contain a period (#7456)

This commit is contained in:
Tony Murray
2017-10-11 02:10:04 -05:00
committed by Neil Lathwood
parent 3d41019b61
commit 46ee1b377c

View File

@@ -202,8 +202,16 @@ function snmp_get_multi($device, $oids, $options = '-OQUs', $mib = null, $mibdir
$oid = trim($oid);
$value = trim($value, "\" \n\r");
list($oid, $index) = explode('.', $oid, 2);
if (!strstr($value, 'at this OID') && isset($oid) && isset($index)) {
$array[$index][$oid] = $value;
if (!str_contains($value, 'at this OID')) {
if (is_null($index)) {
if (empty($oid)) {
continue; // no index or oid
}
$array[$oid] = $value;
} else {
$array[$index][$oid] = $value;
}
}
}