Page MenuHomePhabricator

IPUtils::isIPv(4|6) should return true for ranges in explicit notation
Open, Needs TriagePublic

Description

The method IPUtils::isIPv6 and its isIPv4 counterpart have inconsistency that may lead to bugs where they're called.

They regard IPs in explicit and CIDR notation differently. Treating the former as (not IP) and the latter as (IP).

The method work is only to answer the question whether $ip is an IPv 6|4 addresses or not and therefore they should return true for explicit ranges.

Event Timeline

isValid(IPv[46])? doesn't do ranges

isIPAddress|isIPv4|isIPv6 will do ranges with a prefix only (not explicit)

isValidRange will do any ranges (explicit or prefix)

I'm not quite sure why we need all three types/groups. It feels like we should have one (group) for an IP and one for a range...