Bug #53862 [NEW]: snmp_set_oid_output_format does not allow returning to default etc

From: Date: Thu, 27 Jan 2011 23:18:01 +0000
Subject: Bug #53862 [NEW]: snmp_set_oid_output_format does not allow returning to default etc
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-158251@lists.php.net to get a copy of this message
From:             
Operating system: Irrelevant
PHP version:      5.3.5
Package:          SNMP related
Bug Type:         Bug
Bug description:snmp_set_oid_output_format does not allow returning to default etc

Description:
------------
snmp_set_oid_output_format only allows using the FULL
(SNMP_OID_OUTPUT_FULL) or 
NUMERIC (SNMP_OID_OUTPUT_NUMERIC) setting types, neither of which is the
default.  
It also has no corresponding _get_ function call to query/store and return
the 
setting back to "whatever it was before I touched it"

I've attached a patch which does both (from the 5.3 branch), extends the
existing 
function to include the available types in UCD Net-SNMP as of 5.4 (not 
verified/checked against older ones, have not verified that setting to
_NONE will 
not cause crashes).

Test script:
---------------
$rvDefault = snmp2_get('127.0.0.1','public','.1.3.6.1.2.1.1.2.0');

snmp_set_oid_output_format(SNMP_OID_OUTPUT_FULL);
$rvFull = snmp2_get('127.0.0.1','public','.1.3.6.1.2.1.1.2.0');

snmp_set_oid_output_format(SNMP_OID_OUTPUT_NUMERIC);
$rvNumeric = snmp2_get('127.0.0.1','public','.1.3.6.1.2.1.1.2.0');

echo $rvDefault."\n";
echo $rvFull."\n";
echo $rvNumeric."\n";



Expected result:
----------------
Setting either SNMP_OID_OUTPUT_FULL or SNMP_OID_OUTPUT_NUMERIC would return
the 
library to it's default.  Expect there to be an snmp_get_oid_output_format
call as 
well to query the current setting.

Actual result:
--------------
Neither of the available snmp_set_oid_output_format constants can return
the 
library to it's default settings.  No ability to query the library for the
current 
setting.

-- 
Edit bug report at http://bugs.php.net/bug.php?id=53862&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=53862&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=53862&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=53862&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=53862&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53862&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=53862&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=53862&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=53862&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=53862&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=53862&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=53862&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=53862&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=53862&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=53862&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53862&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53862&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=53862&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=53862&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=53862&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=53862&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=53862&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#158251) next »