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

From: Date: Sun, 05 Jan 2014 15:19:22 +0000
Subject: Bug #46065 [Com]: snmp_set_quick_print() persists between requests
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183598@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=46065&edit=1

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

 New Comment:

Bug still present in "PHP 5.3.10-1ubuntu3.9 with Suhosin-Patch (cli) (built: Dec 12 2013
04:27:25)".

$ cat snmp_get_quick_print.php 
<?php printf("snmp_get_quick_print: '%s' || %d\n", snmp_get_quick_print(),
posix_getpid()); ?>

$ cat snmp_set_quick_print.php 
<?php printf("snmp_set_quick_print: '%s' || %d\n",
snmp_set_quick_print(true), posix_getpid()); ?>

$ for (( i=0; i<5; i++ )) ; do links -dump http://localhost/snmp_get_quick_print.php;
done
   snmp_get_quick_print: '' || 3458
   snmp_get_quick_print: '' || 3459
   snmp_get_quick_print: '' || 3460
   snmp_get_quick_print: '' || 3461
   snmp_get_quick_print: '' || 3462

$ links -dump http://localhost/snmp_set_quick_print.php
   snmp_set_quick_print: '' || 3458

$ for (( i=0; i<5; i++ )) ; do links -dump http://localhost/snmp_get_quick_print.php;
done
   snmp_get_quick_print: '' || 3459
   snmp_get_quick_print: '' || 3460
   snmp_get_quick_print: '' || 3461
   snmp_get_quick_print: '' || 3462
   snmp_get_quick_print: '1' || 3458


Previous Comments:
------------------------------------------------------------------------
[2012-02-25 09:41:00] lytboris@php.net

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.



------------------------------------------------------------------------
[2011-01-31 12:58:04] lytboris@php.net

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

------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=46065&edit=1


Thread (7 messages)

« previous php.bugs (#183598) next »