Skip to content
Browse files

Don't OR options together.

By default FILTER_VALIDATE_IP does both.
  • Loading branch information...
1 parent 963f1ca commit c31858635fcb480c4e301140db4eb352767e600e @markstory markstory committed Jun 10, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/Cake/Utility/Validation.php
View
8 lib/Cake/Utility/Validation.php
@@ -468,11 +468,11 @@ public static function extension($check, $extensions = array('gif', 'jpeg', 'png
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));
}

0 comments on commit c318586

Please sign in to comment.
Something went wrong with that request. Please try again.