Browse Source

Don't OR options together.

By default FILTER_VALIDATE_IP does both.
mark_story 14 years ago
parent
commit
c31858635f
1 changed files with 4 additions and 4 deletions
  1. 4 4
      lib/Cake/Utility/Validation.php

+ 4 - 4
lib/Cake/Utility/Validation.php

@@ -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));
 	}