Bug #46065 [Opn->Fbk]: snmp_set_quick_print() persists between requests

From: Date: Mon, 31 Jan 2011 11:58:04 +0000
Subject: Bug #46065 [Opn->Fbk]: snmp_set_quick_print() persists between requests
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-158362@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=46065&edit=1

 ID:                 46065
 Updated by:         lytboris@php.net
 Reported by:        php at painfullscratch dot nl
 Summary:            snmp_set_quick_print() persists between requests
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            SNMP related
 Operating System:   *
 PHP Version:        5.*, 6
-Assigned To:        
+Assigned To:        lytboris
 Block user comment: N
 Private report:     N

 New Comment:

Please try using this snapshot:

  http://snaps.php.net/php-trunk-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

Please check OO API from trunk. It has an option to specify session-wise
OID output format and more.

Sources in trunk can be compiled against downto php 5.2


Previous Comments:
------------------------------------------------------------------------
[2009-09-08 21:16:19] larryjadams at comcast dot net

The snmp module needs a bit of rededesign.  It should handle many of the
commands from the native calls, like multiple OID get's in a single
array, in other words, make the OID a mixed type for a get request.

Also, the snmp functions should require a resource (aka snmp session) in
order to work, just like is done in the API, for which it would be
based.

In that case, to setup a quick print, you start a session, receive a
pointer to a (structure/resource) in return and then all subsequent
calls need to also pass the resource to the function.  Once you are
done, you need to close the sessions.

This will have to be a new class of calls though as simply changing
thing around will make life difficult for everyone.

TheWitness

------------------------------------------------------------------------
[2008-10-24 08:56:21] jani@php.net

It's pretty simple issue, propably need to add some netsnmp shutdown
function in RINIT which clears all the settings between requests.

------------------------------------------------------------------------
[2008-09-12 13:27:09] php at painfullscratch dot nl

Description:
------------
When PHP runs under Apache and snmp_set_quick_print(TRUE) is issued, the
behavior of all SNMP-related functions will be "quick print" for the
lifetime of the PID. 

NET-SNMP Support => enabled
NET-SNMP Version => 5.4.1
PHP version: 5.2.4

There are two possibilities:
 1) This behavior is "by design": If this is the case I think the manual
page for snmp_set_quick_print() needs a warning for this behavior.
 2) This is a bug: For each PID the behavior should be (re)set to the
default behavior after execution of the script.


Reproduce code:
---------------
pet@workmate:/tmp$ sudo /etc/init.d/apache2 restart > /dev/null 2>&1
pet@workmate:/tmp$ for (( i=0; i<5; i++ )) ; do links -dump
http://localhost/snmp_get_quick_print.php;
done
   snmp_get_quick_print: '' | pid: '9402'
   snmp_get_quick_print: '' | pid: '9403'
   snmp_get_quick_print: '' | pid: '9404'
   snmp_get_quick_print: '' | pid: '9405'
   snmp_get_quick_print: '' | pid: '9406'
pet@workmate:/tmp$ links -dump
http://localhost/snmp_set_quick_print.php
   snmp_set_quick_print: '' | pid: '9406'
pet@workmate:/tmp$ for (( i=0; i<5; i++ )) ; do links -dump
http://localhost/snmp_get_quick_print.php;
done
   snmp_get_quick_print: '' | pid: '9403'
   snmp_get_quick_print: '' | pid: '9404'
   snmp_get_quick_print: '' | pid: '9446'
   snmp_get_quick_print: '' | pid: '9405'
   snmp_get_quick_print: '1' | pid: '9406'



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=46065&edit=1


Thread (7 messages)

« previous php.bugs (#158362) next »