|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-05-18 13:35 UTC] rasmus at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 17 22:00:01 2025 UTC |
snmprealwalk() - see /* $Id: snmp.c,v 1.11 1999/04/05 18:07:05 sas Exp $ */ The snmprealwalk() function returns an array of OID/value pairs; however, the OID/value pairs are offset because the returned OID is the requested OID and not the returned OID. Here is an example: <script language="php"> $walk = snmprealwalk("127.0.0.1", "public", "interfaces.ifTable.ifEntry.ifIndex"); reset($walk); while ( list($key,$val) = each($walk) ){ echo "$key => $val<br>"; } echo "</PRE>"; </script> </BODY> </HTML> This produces the following (incorrect) output: interfaces.ifTable.ifEntry.ifIndex => 1 interfaces.ifTable.ifEntry.ifIndex.1 => 2 interfaces.ifTable.ifEntry.ifIndex.2 => 3 interfaces.ifTable.ifEntry.ifIndex.3 => 4 ... The following change corrects the problem: 29,30c29 < /* $Id: snmp.c,v 1.12 1999/04/05 18:07:05 mhjack Exp $ */ < --- > /* $Id: snmp.c,v 1.11 1999/04/05 18:07:05 sas Exp $ */ 234c233 < sprint_objid(buf2, vars->name, vars->name_length); --- > sprint_objid(buf2, name, name_length); This changes the output to be correct: interfaces.ifTable.ifEntry.ifIndex.1 => 1 interfaces.ifTable.ifEntry.ifIndex.2 => 2 interfaces.ifTable.ifEntry.ifIndex.3 => 3 interfaces.ifTable.ifEntry.ifIndex.4 => 4 ... A full context diff file is available at: http://kes.tscnet.com/snmp.c.diff Thanks..