When passing an empty string as the IP like this:
$ip = '';
$is_remote = Ip::isRemote($ip);
it returns true, even thought the IP itself is invalid.
This is because isLocal() returns false (due to the IP being invalid), and isRemote() simply switches the result to true.
Workaround:
$ip = '';
$is_remote = Ip::isValid($ip) && Ip::isRemote($ip);
When passing an empty string as the IP like this:
it returns
true, even thought the IP itself is invalid.This is because
isLocal()returnsfalse(due to the IP being invalid), andisRemote()simply switches the result totrue.Workaround: