Skip to content

Commit

Permalink
Don't OR options together.
Browse files Browse the repository at this point in the history
By default FILTER_VALIDATE_IP does both.
  • Loading branch information
markstory committed Jun 11, 2012
1 parent 963f1ca commit c318586
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Cake/Utility/Validation.php
Expand Up @@ -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));
}
Expand Down

0 comments on commit c318586

Please sign in to comment.