Skip to content

Commit

Permalink
fix(IP处理): 修复上个commit引入的bug(x
Browse files Browse the repository at this point in the history
  • Loading branch information
tongyifan committed Aug 10, 2019
1 parent aee0912 commit 3f01a60
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/globalfunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ function getip()

function validateIPv6($IP)
{
$IP = IPLib\Factory::addressFromString($IP)->toString(true);
try {
$IP = IPLib\Factory::addressFromString($IP)->toString(true);
} catch (Exception $e) {
return false;
}
return filter_var($IP, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
}

Expand Down

0 comments on commit 3f01a60

Please sign in to comment.