Steps to reproduce
- Block ::1 via Special:GlobalBlock
- (optional) Note the block's ID in globalblocks.gb_id
- Go to Special:GlobalBlockWhitelist and locally disable the block for ::1
- Remove the block for ::1 via Special:GlobalUnblock
- (optional) Observe that the row is still present in global_block_whitelist (and gbw_id is the removed block's ID)
- Go to Special:GlobalBlockWhitelist. Enter ::1 as the IP address and check "disable". Submit.
Expected: The IP is whitelisted
Actual: See the error You made no change to the local status of this block.
Problem
When a global block is removed, the whitelist row is not removed. This means that row can exist in global_block_whitelist that refers to an old block that doesn't exist any more.
SpecialGlobalBlockStatus looks up (1) whether a block exists for this IP and (2) whether a whitelist exists for this block. However, it uses the user input for (1) rather than the sanitized IP, so it doesn't find a block. So it has no block ID for (2), so only looks up whether the IP is whitelisted for any block ID. If an old whitelist row exists, it finds this and errors out.
Solution
We should use the sanitized IP to look up the block.
Note: Visiting Special:GlobalBlockWhitelist/::1 does work, because this prefills the input with the sanitized IP.