From c31858635fcb480c4e301140db4eb352767e600e Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 10 Jun 2012 20:29:48 -0400 Subject: [PATCH] Don't OR options together. By default FILTER_VALIDATE_IP does both. --- lib/Cake/Utility/Validation.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Cake/Utility/Validation.php b/lib/Cake/Utility/Validation.php index 1e19e2b8f8a..bcf8e7b627e 100644 --- a/lib/Cake/Utility/Validation.php +++ b/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)); }