|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #38516 functions snmpgetnext and snmp2_getnext do not work
Submitted: 2006-08-20 03:08 UTC Modified: 2011-03-20 22:19 UTC
From: larryjadams at comcast dot net Assigned:
Status: Closed Package: SNMP related
PHP Version: 5.1.5 OS: Win32
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: larryjadams at comcast dot net
New email:
PHP Version: OS:


 [2006-08-20 03:08 UTC] larryjadams at comcast dot net
The snmpgetnext function does not work in the PHP distributions.  This has been an issue for a while, but I am just getting around to publishing the bug.  Sorry...

Reproduce code:
print snmp2_getnext("localhost","pubilc",".");


print snmpgetnext("localhost","pubilc",".");

Expected result:
If you run the following command:

snmpgetnext -v 1 -c public localhost you would get

. = STRING: Hardware: x86 Family 6 Model 13 Stepping 8 AT/AT COMPATIBLE - Software: Windows 2000 Versio
n 5.1 (Build 2600 Uniprocessor Free)

Actual result:
Warning: snmp2_getnext(): No response from localhost in C:\test.php on line 2


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-23 12:27 UTC] metaur at telia dot com
Wrong community string? (One of your examples say "public" and the other says "pubilc".)

// Ulf H?rnhammar
 [2006-08-23 15:18 UTC] larryjadams at comcast dot net
You are right, daddy needs a new pair of glasses.  However, if you set the OID string to "", it still fails, while, if you run the following command from the command line it will still work:

snmpgetnext -c public -v 1 localhost

The php_snmp requires the OID to be something other than a blank string.
 [2006-08-23 15:39 UTC] larryjadams at comcast dot net

How bout I send you a fix.  I can do that much np.  I could also send you the fix to build net-snmp for windows rather than ucd-snmp if you like.
 [2006-08-23 17:05 UTC]
What fix are you talking about?
Please explain first what do you think is wrong and how to reproduce it.
 [2006-08-23 17:33 UTC] larryjadams at comcast dot net
Sorry Tony, the OID should be optional in this call.  If it is found to be blank, the function should behave like net-snmp's getnext when it is called without an OID, which is to return the first OID from the entire tree, typically sysDescr.

Today it is not optional and fails when left to a blank string.
 [2011-02-21 21:23 UTC]
-Package: Feature/Change Request +Package: SNMP related
 [2011-03-20 15:24 UTC] ch at lathspell dot de
At least it works as supposed on Linux with Net-SNMP and PHP-5.3.6...

 $ php -r 'print_r(snmpwalkoid("localhost", "public", ""));' | head
    [SNMPv2-MIB::sysDescr.0] => STRING: Linux james 2.6.37-2-amd64 #1 SMP Sun  Feb 27 10:12:22 UTC 2011 x86_64
     [SNMPv2-MIB::sysObjectID.0] => OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
 [2011-03-20 22:19 UTC] larryjadams at comcast dot net
-Status: Open +Status: Closed
 [2011-03-20 22:19 UTC] larryjadams at comcast dot net
Not a problem.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 22:01:30 2024 UTC