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

 ID:                 64124
 Updated by:         lytbo...@php.net
 Reported by:        andy at root dot lu
 Summary:            IPv6 malformed
-Status:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            SNMP related
 Operating System:   *
 PHP Version:        5.4.*
 Assigned To:        lytboris
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of lytboris
Revision: 
http://git.php.net/?p=php-src.git;a=commit;h=ed6763420c10c5eb47d6db675322ecaa6de079b6
Log: fix bug #64124 (IPv6 malformed)


Previous Comments:
------------------------------------------------------------------------
[2013-02-07 08:01:07] lytbo...@php.net

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

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

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


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

Reply via email to