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:             Feedback
+Status:             Assigned
 Type:               Bug
 Package:            SNMP related
 Operating System:   Debian Squeeze
 PHP Version:        5.4.11
 Assigned To:        lytboris
 Block user comment: N
 Private report:     N

 New Comment:

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)


Previous Comments:
------------------------------------------------------------------------
[2013-02-06 21:48:19] johan...@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] johan...@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.

------------------------------------------------------------------------
[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

Reply via email to