Mvorisek Mvorisek - 2 months ago 20
Linux Question

BUG in PHP 7.0.11, FILTER_FLAG_NO_RES_RANGE

var_dump(filter_var('10.1.1.1', FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));


prints (in PHP 7.0.11):

bool(false)


But according the documentation is should print:

string(8) "10.1.1.1"



PHPDOC: FILTER_FLAG_NO_RES_RANGE
http://php.net/manual/en/filter.filters.flags.php

Fails validation for the following reserved IPv4 ranges: 0.0.0.0/8,
169.254.0.0/16, 127.0.0.0/8 and 240.0.0.0/4.

Fails validation for the following reserved IPv6 ranges: ::1/128,
::/128, ::ffff:0:0/96 and fe80::/10.


Is this a bug or am I missing something?

Answer

10.1.1.1 is a reserved IP addresses. This was a breaking change introduced with #1954. It will be fixed with #2113.

Comments