Bug #69739 [NEW]: PHP SNMP Real Walk returns bad characters
| From: | kriz at mysafira dot net | Date: | Mon, 01 Jun 2015 15:24:12 +0000 |
| Subject: | Bug #69739 [NEW]: PHP SNMP Real Walk returns bad characters | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-193049@lists.php.net to get a copy of this message | ||
From: kriz at mysafira dot net
Operating system: Ubuntu 14.04.2, Windows 7 x64
PHP version: Irrelevant
Package: SNMP related
Bug Type: Bug
Bug description:PHP SNMP Real Walk returns bad characters
Description:
------------
I read via PHP function snmp2_real_walk OID value
'.1.3.6.1.2.1.17.4.3.1.1' for get MAC address from Cisco switch device.
Problem is, that some results (randomly around the 50 results of the
200) return bad characters (yet I have found a mistake if I read only
MAC addresses). Ie.:
correct output examples:
[Dot1dTpFdbAddres] => 30 05 5C 38 A7 8C
[Dot1dTpFdbAddres] => C0 7B BC 0E 56 18
wrong output examples - device return randomly none-hex value for hex
values, ie.:
[iso.3.6.1.2.1.17.4.3.1.1.92.38.10.129.123.27] => Hex-STRING: 5C 26 0A
81 7B 1B
[iso.3.6.1.2.1.17.4.3.1.1.120.69.196.42.25.241] => Hex-STRING: 78 45 C4
2A 19 F1
[iso.3.6.1.2.1.17.4.3.1.1.120.69.196.42.27.169] => Hex-STRING: 78 45 C4
2A 1B A9
[iso.3.6.1.2.1.17.4.3.1.1.120.69.196.42.34.45] => STRING: "xE�*\"-"
[iso.3.6.1.2.1.17.4.3.1.1.120.172.192.142.199.214] => STRING:
"x�����"
[iso.3.6.1.2.1.17.4.3.1.1.124.30.179.254.9.201] => Hex-STRING: 7C 1E B3
FE 09 C9
If I try read OID '.1.3.6.1.2.1.17.4.3.1.1' from program Getif, I have
got correct results.
The tested solution that fails:
PHP - Chnaged snmp2_real_walk by snmprealwalk
Changed encoding of files (UTF8, ANSI)
SNMP longer timeout and try add PHP sleep() function
PHP directive: snmp_set_oid_numeric_print(1)
PHP directive: snmp_set_quick_print(true)
PHP directive: snmp_set_enum_print(true)
PHP directive: snmp_set_valueretrieval(SNMP_VALUE_LIBRARY and
SNMP_VALUE_PLAIN)
Resolution - add new parameter for:
snmprealwalk
snmp2_real_walk
for forced return Hex-STRING result.
Test script:
---------------
$arrDot1dTpFdbAddress = snmprealwalk("SomeIp:161", "ReadCommunity",
".1.3.6.1.2.1.3.1.1.2", (1000000 * 1), 3);
echo '<pre>';
print_r($arrDot1dTpFdbAddress);
echo '</pre>';
--
Edit bug report at https://bugs.php.net/bug.php?id=69739&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69739&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69739&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69739&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69739&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69739&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69739&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69739&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69739&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69739&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69739&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69739&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69739&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69739&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69739&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69739&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69739&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69739&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69739&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69739&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69739&r=mysqlcfg