From 1ec49ff3d32d28a1843827c47a145698896046a8 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 6 Sep 2011 23:15:42 +0000 Subject: [PATCH] Fixed typo in ipv6 private IP range list and added test (bug 30739) --- includes/IP.php | 2 +- tests/phpunit/includes/IPTest.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) 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. -- 2.20.1