Edit report at https://bugs.php.net/bug.php?id=64124&edit=1
ID: 64124
Updated by: lytboris@php.net
Reported by: andy at root dot lu
Summary: IPv6 malformed
Status: Assigned
Type: Bug
Package: SNMP related
-Operating System: Debian Squeeze
+Operating System: *
-PHP Version: 5.4.11
+PHP Version: 5.4.*
Assigned To: lytboris
Block user comment: N
Private report: N
New Comment:
johannes, I found the same bug source an currently I'm in the middle of testing it.
ps. I wonder why specifying "s/" in param parsing call is not enough...
Previous Comments:
------------------------------------------------------------------------
[2013-02-06 22:11:02] andy at root dot lu
Hi,
patch went well, but I am getting a segmentation fault while executing the code.
I made sure to use make distclean first, so I recompiled everything from scratch.
I used the current built: php5.4-201302011830 (which worked with the same test
code before I applied the patch)
------------------------------------------------------------------------
[2013-02-06 21:48:19] johannes@php.net
Hi Andy,
I don't have an SNMP-enabled device at hand, can you try this patch?
https://github.com/johannes/php-src/compare/bug64124.diff
This should fix the only potential problem explaining this. Thanks.
------------------------------------------------------------------------
[2013-02-01 19:12:33] andy at root dot lu
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
------------------------------------------------------------------------
[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] johannes@php.net
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.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=64124
--
Edit this bug report at https://bugs.php.net/bug.php?id=64124&edit=1