FAQ
Edit report at https://bugs.php.net/bug.php?id=64159&edit=1

  ID: 64159
  Updated by: lytboris@php.net
  Reported by: loic dot blot at unix-experience dot fr
  Summary: Truncated snmpget
  Status: Open
  Type: Bug
  Package: SNMP related
-Operating System: FreeBSD 9.1
+Operating System: *
  PHP Version: 5.4.11
  Block user comment: N
  Private report: N

  New Comment:

Basically this is because of loosy algorithm predicting string length produced by snmp library function that prints OID values.
As a walkaround one can set
===
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
===
(or OO API [SNMP Object]->valueretrieval)
and then use bin2hex to decode binary string into hex string.


Previous Comments:
------------------------------------------------------------------------
[2013-02-20 18:40:33] yordan dot yordanov@innologica.com

Happening to me aslo. Here's my reproduction:

[root@monitor ~]# snmpwalk -cpublic -v1 192.168.0.232 -On
.1.3.6.1.4.1.9.9.46.1.6.1.1.4.10003
.1.3.6.1.4.1.9.9.46.1.6.1.1.4.10003 = Hex-STRING: 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00
[root@monitor ~]# php -r
'print_r(snmprealwalk("192.168.0.232","public",".1.3.6.1.4.1.9.9.46.1.6.1.1.4.10
003"));'
Array
(
     [SNMPv2-SMI::enterprises.9.9.46.1.6.1.1.4.10003] => Hex-STRING: 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

)
[root@monitor ~]# php -v
PHP 5.4.11 (cli) (built: Jan 16 2013 16:51:38)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
[root@monitor ~]# uname -a
Linux xxxxxxxx 2.6.32-279.19.1.el6.x86_64 #1 SMP Wed Dec 19 07:05:20 UTC 2012
x86_64 x86_64 x86_64 GNU/Linux
[root@monitor ~]# cat /etc/centos-release
CentOS release 6.3 (Final)

------------------------------------------------------------------------
[2013-02-06 22:00:27] loic dot blot at unix-experience dot fr

do this on a CISCO 2950, 2960, 3750 or 4500 (that's all devices i have tested) with proper community and ip.

<?php echo snmpget("192.168.1.1","2c","public","1.3.6.1.4.1.9.9.46.1.6.1.1.4"); ?>

------------------------------------------------------------------------
[2013-02-06 21:54:24] johannes@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.



------------------------------------------------------------------------
[2013-02-05 16:18:46] loic dot blot at unix-experience dot fr

Description:
------------
Hello,
Since php 5.4.11 i get a problem on snmpget function. I haven't the problem with system snmpget command.

large responses for snmpget are truncated.

I think there is a buffer problem.

Expected result:
----------------
but instead i get:
7F FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

Actual result:
--------------
For example, snmpget (on CISCO switches), really returns:
7F FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF


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

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 9 | next ›
Discussion Overview
groupphp-bugs @
categoriesphp
postedFeb 5, '13 at 4:19p
activeNov 17, '13 at 9:31a
posts9
users4
websitephp.net

People

Translate

site design / logo © 2019 Grokbase