Reserved IPs not detected by filter_var()

103 views Asked by At

A few IPs aren't being detected as "reserved" by PHP.

For example, these:

229.39.139.126 - https://ip-api.com/#229.39.139.126
239.148.182.94 - https://ip-api.com/#239.148.182.94

Are reported as "reserved range" in the website above.
Other IP services also say these IPs are invalid.

    return filter_var(
        $ip, 
        FILTER_VALIDATE_IP, 
        FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE
    ) !== false;

Am I doing anything wrong, or could this be a bug in PHP?

0

There are 0 answers