IP validation inconsistent from php 5.6.25
Can anyone explain why the following code returns truthy in < 5.6.25, and false for everything above?
My understanding is it should be truthy, as
192.168.0.1 is a valid internal IP.
var_dump(filter_var('192.168.0.1', FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE | FILTER_FLAG_IPV4));
See results across versions: https://3v4l.org/u9OFt
1 Answers IP validation inconsistent from php 5.6.25
192.168.x is in the reserved range for class C addresses and you have specified FILTER_FLAG_NO_RES_RANGE to exclude them.
It's possible this was a fixed bug in 5.6.25 onwards, with a regression in the initial versions of 7.x