Fixed action=query list=blocks for IPv6 addresses
authorMarius Hoch <hoo@online.de>
Sun, 11 Nov 2012 02:25:17 +0000 (03:25 +0100)
committerMarius Hoch <hoo@online.de>
Sun, 11 Nov 2012 02:25:17 +0000 (03:25 +0100)
Queries like the following return wrong rangestart and rangeend
data cause the IP addresses are formated with only IPv4 in mind.
As IP::formatHex is able to format both I've switched over to
that.

Example:
http://en.wikipedia.org/w/api.php?format=xml&action=query&list=blocks&bkprop=range&bkip=2002%3AB752%3AD225%3A0%3A0%3A0%3A0%3A1

Change-Id: I6138240bb03bbf5af61851d3e96354a050e56fed

includes/api/ApiQueryBlocks.php

index a8d4a7c..7cc1755 100644 (file)
@@ -182,8 +182,8 @@ class ApiQueryBlocks extends ApiQueryBase {
                                $block['reason'] = $row->ipb_reason;
                        }
                        if ( $fld_range && !$row->ipb_auto ) {
-                               $block['rangestart'] = IP::hexToQuad( $row->ipb_range_start );
-                               $block['rangeend'] = IP::hexToQuad( $row->ipb_range_end );
+                               $block['rangestart'] = IP::formatHex( $row->ipb_range_start );
+                               $block['rangeend'] = IP::formatHex( $row->ipb_range_end );
                        }
                        if ( $fld_flags ) {
                                // For clarity, these flags use the same names as their action=block counterparts