php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64124 IPv6 malformed
Submitted: 2013-02-01 10:10 UTC Modified: 2013-02-14 06:27 UTC
From: andy at root dot lu Assigned: lytboris (profile)
Status: Closed Package: SNMP related
PHP Version: 5.4.* OS: *
Private report: No CVE-ID: None
 [2013-02-01 10:10 UTC] 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");


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-01 11:28 UTC] 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.
 [2013-02-01 11:28 UTC] johannes@php.net
-Status: Open +Status: Feedback
 [2013-02-01 19:03 UTC] andy at root dot lu
-Status: Feedback +Status: Open
 [2013-02-01 19:03 UTC] 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 19:12 UTC] 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-04 02:09 UTC] johannes@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: lytboris
 [2013-02-06 21:48 UTC] 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-06 21:48 UTC] johannes@php.net
-Status: Assigned +Status: Feedback
 [2013-02-06 22:11 UTC] 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 22:11 UTC] andy at root dot lu
-Status: Feedback +Status: Assigned
 [2013-02-07 08:01 UTC] lytboris@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-07 08:01 UTC] lytboris@php.net
-Operating System: Debian Squeeze +Operating System: * -PHP Version: 5.4.11 +PHP Version: 5.4.*
 [2013-02-07 17:36 UTC] lytboris@php.net
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)
 [2013-02-07 17:36 UTC] lytboris@php.net
-Status: Assigned +Status: Closed
 [2013-02-07 17:42 UTC] lytboris@php.net
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)
 [2013-02-07 17:43 UTC] lytboris@php.net
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)
 [2013-02-07 17:51 UTC] lytboris@php.net
-Status: Closed +Status: Feedback
 [2013-02-07 17:51 UTC] lytboris@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.4-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2013-02-13 21:56 UTC] andy at root dot lu
I confirm that there is no more issue with the latest version of php. In my case: 
php5.4-201302132030

Thank you!
 [2013-02-13 21:56 UTC] andy at root dot lu
-Status: Feedback +Status: Assigned
 [2013-02-14 06:27 UTC] lytboris@php.net
-Status: Assigned +Status: Closed
 [2013-02-14 06:27 UTC] lytboris@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2013-02-14 19:15 UTC] lytboris@php.net
Automatic comment on behalf of lytboris
Revision: http://git.php.net/?p=php-src.git;a=commit;h=68fa6a3eb761ad5aeea3aefe1c22be3273fa4fbc
Log: +Fixed bug #64124 (IPv6 malformed). (Boris Lytochkin)
 [2013-02-14 19:15 UTC] lytboris@php.net
Automatic comment on behalf of lytboris
Revision: http://git.php.net/?p=php-src.git;a=commit;h=cddc9f598b251327dfd666b5311905c2b27f34dd
Log: Fixed bug #64124 (IPv6 malformed)
 [2013-02-16 14:25 UTC] laruence@php.net
Automatic comment on behalf of lytboris
Revision: http://git.php.net/?p=php-src.git;a=commit;h=cddc9f598b251327dfd666b5311905c2b27f34dd
Log: Fixed bug #64124 (IPv6 malformed)
 [2013-02-16 14:30 UTC] laruence@php.net
Automatic comment on behalf of lytboris
Revision: http://git.php.net/?p=php-src.git;a=commit;h=68fa6a3eb761ad5aeea3aefe1c22be3273fa4fbc
Log: +Fixed bug #64124 (IPv6 malformed). (Boris Lytochkin)
 [2013-02-16 14:30 UTC] laruence@php.net
Automatic comment on behalf of lytboris
Revision: http://git.php.net/?p=php-src.git;a=commit;h=68fa6a3eb761ad5aeea3aefe1c22be3273fa4fbc
Log: +Fixed bug #64124 (IPv6 malformed). (Boris Lytochkin)
 [2013-11-17 09:31 UTC] laruence@php.net
Automatic comment on behalf of lytboris
Revision: http://git.php.net/?p=php-src.git;a=commit;h=cddc9f598b251327dfd666b5311905c2b27f34dd
Log: Fixed bug #64124 (IPv6 malformed)
 [2014-10-07 23:20 UTC] stas@php.net
Automatic comment on behalf of lytboris
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=68fa6a3eb761ad5aeea3aefe1c22be3273fa4fbc
Log: +Fixed bug #64124 (IPv6 malformed). (Boris Lytochkin)
 [2014-10-07 23:20 UTC] stas@php.net
Automatic comment on behalf of lytboris
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=ed6763420c10c5eb47d6db675322ecaa6de079b6
Log: fix bug #64124 (IPv6 malformed)
 [2014-10-07 23:31 UTC] stas@php.net
Automatic comment on behalf of lytboris
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=68fa6a3eb761ad5aeea3aefe1c22be3273fa4fbc
Log: +Fixed bug #64124 (IPv6 malformed). (Boris Lytochkin)
 [2014-10-07 23:31 UTC] stas@php.net
Automatic comment on behalf of lytboris
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=ed6763420c10c5eb47d6db675322ecaa6de079b6
Log: fix bug #64124 (IPv6 malformed)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 08:01:29 2024 UTC