go to bug id or search bugs for
Currently the SNMP::VERSION class constants have the following internal values:
const integer SNMP::VERSION_1 = 0 ;
const integer SNMP::VERSION_2C = 1 ;
const integer SNMP::VERSION_2c = 1 ;
const integer SNMP::VERSION_3 = 3 ;
As PHP does not yet have the concept of Enums the documentation just says that the first parameter has to be numeric so people will be tempted to enter 1, 2 or 3 as paramter which results in hard to debug errors (it mostly works just some OIDs do not).
Would there be any drawbacks if we change the internal values to 1, 2, 2, 3?
It's still Alpha so no Backward Compatibility problems.
Add a Patch
Add a Pull Request
There are some drawbacks. Look at this portion of code from snmp.h:#ifndef
#define SNMP_VERSION_1 0
#define SNMP_VERSION_2c 1
#define SNMP_VERSION_2u 2 /* not (will never be) supported by this code */
#define SNMP_VERSION_3 3
* versions not based on a version field
#define SNMP_VERSION_sec 128 /* not (will never be) supported by this code */
#define SNMP_VERSION_2p 129 /* no longer supported by this code (> 4.0) */
#define SNMP_VERSION_2star 130 /* not (will never be) supported by this code */
There are 4 versions of protocol that are glued to major "second" version. I am not sure that any user specifying '2' in SNMP constructor call would mean 2c.
I will fix constructor manual adding note that version parameter should be a SNMP class version constant and not an ordinary integer.
Why don't you just swap SNMP_VERSION_2c to "2" and SNMP_VERSION_2u to "1"? Then (accidently) specify "2" would lead to a sensible result.
That was quote from Net-SNMP sources, not php-snmp.
Automatic comment from SVN on behalf of lytboris
Log: document FR #55312, #42918