diff --git a/lib/Cake/Test/Case/Utility/ValidationTest.php b/lib/Cake/Test/Case/Utility/ValidationTest.php index 7126f6ecf..bb53c1406 100644 --- a/lib/Cake/Test/Case/Utility/ValidationTest.php +++ b/lib/Cake/Test/Case/Utility/ValidationTest.php @@ -2085,8 +2085,9 @@ class ValidationTest extends CakeTestCase { $this->assertFalse(Validation::multiple('')); $this->assertFalse(Validation::multiple(null)); $this->assertFalse(Validation::multiple(array())); - $this->assertFalse(Validation::multiple(array(0))); - $this->assertFalse(Validation::multiple(array('0'))); + $this->assertTrue(Validation::multiple(array(0))); + $this->assertTrue(Validation::multiple(array('0'))); + $this->assertFalse(Validation::multiple(array(''))); $this->assertTrue(Validation::multiple(array(0, 3, 4, 5), array('in' => range(0, 10)))); $this->assertFalse(Validation::multiple(array(0, 15, 20, 5), array('in' => range(0, 10)))); @@ -2094,8 +2095,9 @@ class ValidationTest extends CakeTestCase { $this->assertFalse(Validation::multiple(array('boo', 'foo', 'bar'), array('in' => array('foo', 'bar', 'baz')))); $this->assertFalse(Validation::multiple(array('foo', '1bar'), array('in' => range(0, 10)))); - $this->assertTrue(Validation::multiple(array(0, 5, 10, 11), array('max' => 3))); - $this->assertFalse(Validation::multiple(array(0, 5, 10, 11, 55), array('max' => 3))); + $this->assertFalse(Validation::multiple(array(1, 5, 10, 11), array('max' => 3))); + $this->assertTrue(Validation::multiple(array(0, 5, 10, 11), array('max' => 4))); + $this->assertFalse(Validation::multiple(array(0, 5, 10, 11, 55), array('max' => 4))); $this->assertTrue(Validation::multiple(array('foo', 'bar', 'baz'), array('max' => 3))); $this->assertFalse(Validation::multiple(array('foo', 'bar', 'baz', 'squirrel'), array('max' => 3))); @@ -2110,8 +2112,8 @@ class ValidationTest extends CakeTestCase { $this->assertFalse(Validation::multiple(array(0, 5, 9, 8, 6, 2, 1), array('in' => range(0, 10), 'max' => 5))); $this->assertFalse(Validation::multiple(array(0, 5, 9, 8, 11), array('in' => range(0, 10), 'max' => 5))); - $this->assertFalse(Validation::multiple(array(0, 5, 9), array('in' => range(0, 10), 'max' => 5, 'min' => 3))); - $this->assertFalse(Validation::multiple(array(0, 5, 9, 8, 6, 2, 1), array('in' => range(0, 10), 'max' => 5, 'min' => 2))); + $this->assertFalse(Validation::multiple(array(-1, 5, 9), array('in' => range(0, 10), 'max' => 5, 'min' => 3))); + $this->assertFalse(Validation::multiple(array(-1, 5, 9, 8, 6, 2, 1), array('in' => range(0, 10), 'max' => 5, 'min' => 2))); $this->assertFalse(Validation::multiple(array(0, 5, 9, 8, 11), array('in' => range(0, 10), 'max' => 5, 'min' => 2))); $this->assertFalse(Validation::multiple(array('2x', '3x'), array('in' => array(1, 2, 3, 4, 5)))); diff --git a/lib/Cake/Utility/Validation.php b/lib/Cake/Utility/Validation.php index a2243694d..d5e0e4594 100644 --- a/lib/Cake/Utility/Validation.php +++ b/lib/Cake/Utility/Validation.php @@ -143,7 +143,7 @@ class Validation { * Returns true if $check is in the proper credit card format. * * @param string|array $check credit card number to validate - * @param string|array $type 'all' may be passed as a sting, defaults to fast which checks format of most major credit + * @param string|array $type 'all' may be passed as a sting, defaults to fast which checks format of most major credit * cards * if an array is used only the values of the array are checked. * Example: array('amex', 'bankcard', 'maestro') @@ -594,7 +594,7 @@ class Validation { $defaults = array('in' => null, 'max' => null, 'min' => null); $options += $defaults; - $check = array_filter((array)$check); + $check = array_filter((array)$check, 'strlen'); if (empty($check)) { return false; }