Bug #74642 [Opn->Csd]: snmprealwalk resets oid output format
| From: | mattias dot wallin at salanet dot se | Date: | Mon, 12 Jun 2017 06:31:48 +0000 |
| Subject: | Bug #74642 [Opn->Csd]: snmprealwalk resets oid output format | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-209492@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74642&edit=1
ID: 74642
User updated by: mattias dot wallin at salanet dot se
Reported by: mattias dot wallin at salanet dot se
Summary: snmprealwalk resets oid output format
-Status: Open
+Status: Closed
Type: Bug
Package: SNMP related
Operating System: Ubuntu 14.04 LTS
PHP Version: 7.0.19
Block user comment: N
Private report: N
New Comment:
Yes, you are right.
I think i get how this confused me now..
When using snmprealwalk with numeric OID the MIB is not loaded, and therefore do not know about enum
values.
Second call needs to load the MIB to parse the OID, which makes the enum values known and used for
this and subsequent calls.
Using snmp_set_enum_print(0) do not change the actual result. But it is probably not a bug.
Previous Comments:
------------------------------------------------------------------------
[2017-06-10 23:58:30] php at mcq8 dot be
Based on what you have in the expected result, you want to use snmp_set_enum_print(1) instead of
snmp_set_oid_output_format(SNMP_OID_OUTPUT_NUMERIC)?
The OIDs are in fact all numeric as expected in your example.
------------------------------------------------------------------------
[2017-05-24 10:00:20] mattias dot wallin at salanet dot se
Description:
------------
snmprealwalk with non numeric object_id resets oid output format for current call, and future calls.
Test script:
---------------
<?php
snmp_set_oid_output_format(SNMP_OID_OUTPUT_NUMERIC);
print_r(snmprealwalk('1.2.3.4', 'public',
'.1.3.6.1.2.1.17.2.15.1.3.1'));
print_r(snmprealwalk('1.2.3.4', 'public',
'BRIDGE-MIB::dot1dStpPortState.1'));
print_r(snmprealwalk('1.2.3.4', 'public',
'.1.3.6.1.2.1.17.2.15.1.3.1'));
?>
Expected result:
----------------
Array
(
[.1.3.6.1.2.1.17.2.15.1.3.1] => INTEGER: 5
)
Array
(
[.1.3.6.1.2.1.17.2.15.1.3.1] => INTEGER: 5
)
Array
(
[.1.3.6.1.2.1.17.2.15.1.3.1] => INTEGER: 5
)
Actual result:
--------------
Array
(
[.1.3.6.1.2.1.17.2.15.1.3.1] => INTEGER: 5
)
Array
(
[.1.3.6.1.2.1.17.2.15.1.3.1] => INTEGER: forwarding(5)
)
Array
(
[.1.3.6.1.2.1.17.2.15.1.3.1] => INTEGER: forwarding(5)
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74642&edit=1