Permalink
Browse files

Merge branch '2.1' into 2.2

  • Loading branch information...
2 parents 7ae660c + c318586 commit 76dd49145a6058ce34b113c11f1f5e55c670624e @markstory markstory committed Jun 11, 2012
Showing with 6 additions and 6 deletions.
  1. +1 −1 lib/Cake/Test/Case/Utility/ValidationTest.php
  2. +5 −5 lib/Cake/Utility/Validation.php
@@ -1657,7 +1657,7 @@ public function testEqualTo() {
* @return void
*/
public function testIpV4() {
- $this->assertTrue(Validation::ip('0.0.0.0'));
+ $this->assertTrue(Validation::ip('0.0.0.0', 'ipv4'));
$this->assertTrue(Validation::ip('192.168.1.156'));
$this->assertTrue(Validation::ip('255.255.255.255'));
$this->assertFalse(Validation::ip('127.0.0'));
@@ -468,12 +468,12 @@ public static function extension($check, $extensions = array('gif', 'jpeg', 'png
*/
public static function ip($check, $type = 'both') {
$type = strtolower($type);
- $flags = null;
- if ($type === 'ipv4' || $type === 'both') {
- $flags |= FILTER_FLAG_IPV4;
+ $flags = 0;
+ 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 76dd491

Please sign in to comment.