From: Aaron Schulz Date: Tue, 6 Sep 2011 23:15:42 +0000 (+0000) Subject: Fixed typo in ipv6 private IP range list and added test (bug 30739) X-Git-Tag: 1.31.0-rc.0~27857 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=1ec49ff3d32d28a1843827c47a145698896046a8;p=lhc%2Fweb%2Fwiklou.git Fixed typo in ipv6 private IP range list and added test (bug 30739) --- diff --git a/includes/IP.php b/includes/IP.php index 20760d6a28..152236f738 100644 --- a/includes/IP.php +++ b/includes/IP.php @@ -378,7 +378,7 @@ class IP { static $privateRanges = false; if ( !$privateRanges ) { $privateRanges = array( - array( 'fc::', 'fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' ), # RFC 4193 (local) + array( 'fc00::', 'fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' ), # RFC 4193 (local) array( '0:0:0:0:0:0:0:1', '0:0:0:0:0:0:0:1' ), # loopback ); } diff --git a/tests/phpunit/includes/IPTest.php b/tests/phpunit/includes/IPTest.php index 6232d4bcfc..bd1113b336 100644 --- a/tests/phpunit/includes/IPTest.php +++ b/tests/phpunit/includes/IPTest.php @@ -272,10 +272,14 @@ class IPTest extends MediaWikiTestCase { * @covers IP::isPublic */ public function testPrivateIPs() { - $private = array( 'fc::3', 'fc::ff', '::1', '10.0.0.1', '172.16.0.1', '192.168.0.1' ); + $private = array( 'fc00::3', 'fc00::ff', '::1', '10.0.0.1', '172.16.0.1', '192.168.0.1' ); foreach ( $private as $p ) { $this->assertFalse( IP::isPublic( $p ), "$p is not a public IP address" ); } + $public = array( '2001:5c0:1000:a::133', 'fc::3' ); + foreach ( $public as $p ) { + $this->assertTrue( IP::isPublic( $p ), "$p is a public IP address" ); + } } // Private wrapper used to test CIDR Parsing.