Req #55312 [Opn->Wfx]: Please change SNMP::VERSION_ constants to sensible values
Edit report at https://bugs.php.net/bug.php?id=55312&edit=1
ID: 55312
Updated by: lytboris@php.net
Reported by: ch@php.net
Summary: Please change SNMP::VERSION_ constants to sensible
values
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: SNMP related
PHP Version: 5.4.0alpha2
-Assigned To:
+Assigned To: lytboris
Block user comment: N
Private report: N
New Comment:
There are some drawbacks. Look at this portion of code from snmp.h:#ifndef
==================
NETSNMP_DISABLE_SNMPV1
#define SNMP_VERSION_1 0
#endif
#ifndef NETSNMP_DISABLE_SNMPV2C
#define SNMP_VERSION_2c 1
#endif
#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.
Previous Comments:
------------------------------------------------------------------------
[2011-07-28 23:26:50] ch@php.net
Description:
------------
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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55312&edit=1
Thread (4 messages)