isRemote() is not the same as !isLocal()
noplanman opened this issue · comments
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);