r98605 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98604‎ | r98605 | r98606 >
Date:05:11, 1 October 2011
Author:aaron
Status:ok
Tags:
Comment:
Tweak r98602: keep the other IP normalization for non-ranges, such as upper case for v6. This keeps it a bit more consistent.
Modified paths:
  • /trunk/phase3/includes/IP.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/IPTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/IPTest.php
@@ -502,7 +502,7 @@
503503 array( '0:1:2:3:4:c5:f6:7/96', '0:1:2:3:4:C5:0:0/96', 'IPv6 range' ),
504504 array( '0:1:2:3:4:5:6:7/120', '0:1:2:3:4:5:6:0/120', 'IPv6 range' ),
505505 array( '0:e1:2:3:4:5:e6:7/128', '0:E1:2:3:4:5:E6:7/128', 'IPv6 silly range' ),
506 - array( '0:1:A2:3:4:5:c6:7', '0:1:A2:3:4:5:c6:7', 'IPv6 non range' ),
 506+ array( '0:c1:A2:3:4:5:c6:7', '0:C1:A2:3:4:5:C6:7', 'IPv6 non range' ),
507507 );
508508 }
509509 }
Index: trunk/phase3/includes/IP.php
@@ -707,11 +707,11 @@
708708 */
709709 public static function sanitizeRange( $range ) {
710710 list( /*...*/, $bits ) = self::parseCIDR( $range );
 711+ list( $start, /*...*/ ) = self::parseRange( $range );
 712+ $start = self::formatHex( $start );
711713 if ( $bits === false ) {
712 - return $range; // wasn't actually a range
 714+ return $start; // wasn't actually a range
713715 }
714 - list( $start, /*...*/ ) = self::parseRange( $range );
715 - $start = self::formatHex( $start );
716716 return "$start/$bits";
717717 }
718718 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r98606MFT r98605aaron05:12, 1 October 2011
r102519REL1_18 MFT r98602, r98603, r98605reedy15:00, 9 November 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r98602Made provideIPCIDRs() not add a '/' if there is no prefix length. Fixes bug 3...aaron04:54, 1 October 2011

Status & tagging log