#46065 [Com]: snmp_set_quick_print() persists between requests

From: Date: Tue, 08 Sep 2009 21:16:21 +0000
Subject: #46065 [Com]: snmp_set_quick_print() persists between requests
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-142113@lists.php.net to get a copy of this message
 ID:               46065
 Comment by:       larryjadams at comcast dot net
 Reported By:      php at painfullscratch dot nl
 Status:           Open
 Bug Type:         SNMP related
 Operating System: *
 PHP Version:      5.*, 6
 New Comment:

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


Previous Comments:
------------------------------------------------------------------------

[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/?id=46065&edit=1



Thread (7 messages)

« previous php.bugs (#142113) next »