mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Don't OR options together.
By default FILTER_VALIDATE_IP does both.
This commit is contained in:
parent
963f1ca449
commit
c31858635f
1 changed files with 4 additions and 4 deletions
|
@ -468,11 +468,11 @@ class Validation {
|
|||
public static function ip($check, $type = 'both') {
|
||||
$type = strtolower($type);
|
||||
$flags = 0;
|
||||
if ($type === 'ipv4' || $type === 'both') {
|
||||
$flags |= FILTER_FLAG_IPV4;
|
||||
if ($type === 'ipv4') {
|
||||
$flags = FILTER_FLAG_IPV4;
|
||||
}
|
||||
if ($type === 'ipv6' || $type === 'both') {
|
||||
$flags |= FILTER_FLAG_IPV6;
|
||||
if ($type === 'ipv6') {
|
||||
$flags = FILTER_FLAG_IPV6;
|
||||
}
|
||||
return (boolean)filter_var($check, FILTER_VALIDATE_IP, array('flags' => $flags));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue