Edit report at https://bugs.php.net/bug.php?id=64124&edit=1
ID: 64124
User updated by: andy at root dot lu
Reported by: andy at root dot lu
Summary: IPv6 malformed
Status: Open
Type: Bug
Package: SNMP related
Operating System: Debian Squeeze
PHP Version: 5.4.11
Block user comment: N
Private report: N
New Comment:
Basically calling snmpget more than once will throw this error.
Code:
$ip = "[2001:abc:dead:beef::22]";
$test = snmpget($ip, "mycommunity", "something");
$test = snmpget($ip, "mycommunity", "something-else");
$test = snmpget($ip, "mycommunity", "something-different");
Throws this error twice:
Warning: snmpget(): malformed IPv6 address, closing square bracket missing in
test.php
Warning: snmpget(): malformed IPv6 address, closing square bracket missing in
test.php
Previous Comments:
------------------------------------------------------------------------
[2013-02-01 19:03:42] andy at root dot lu
Updated to latest. Problem persists.
I noticed something though:
This code works (only 2 lines):
$ip = "[2001:abc:dead:beef::22]";
$test = snmpget($ip, "mycommunity", "something");
This code does not work and throws the error about missing closing bracket:
$ip = "[2001:abc:dead:beef::22]";
for($j=1;$j<5;$j++)
{
$test = snmpget($ip, "mycommunity", "something".$j);
echo "Outlet $j: $test\n";
}
First iteration of for loop works fine, but after second iteration it complains
about malformed ipv6 address, which does not make any sense. Same issue happens
if
I use a while loop.
OUTPUT:
Outlet 1: 1
Warning: snmpget(): malformed IPv6 address, closing square bracket missing in
test.php on line 9
Outlet 2:
Warning: snmpget(): malformed IPv6 address, closing square bracket missing in
test.php on line 9
Outlet 3:
Warning: snmpget(): malformed IPv6 address, closing square bracket missing in
test.php on line 9
Outlet 4:
------------------------------------------------------------------------
[2013-02-01 11:28:01] [email protected]
Please try using this snapshot:
http://snaps.php.net/php5.4-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Works for me (Warning: snmpget(): Invalid object identifier: something in - on
line 3) and code looks correct, too.
------------------------------------------------------------------------
[2013-02-01 10:10:25] andy at root dot lu
Description:
------------
The following straightforward code throws the following warning:
PHP Warning: snmpget(): mailformed IPv6 address, closing square bracket missing
$ip = "[2001:abc:dead:beef::22]";
$test = snmpget($ip, "mycommunity", "something");
Clearly, there is no missing closing bracket. The IPv6 address is working.
Also, the warning has a typo. It should say malformed instead of mailformed :-)
Test script:
---------------
$ip = "[2001:abc:dead:beef::22]";
$test = snmpget($ip, "mycommunity", "something");
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64124&edit=1