diff --git a/cake/libs/validation.php b/cake/libs/validation.php index db9d003c3..339d8668d 100644 --- a/cake/libs/validation.php +++ b/cake/libs/validation.php @@ -632,7 +632,7 @@ class Validation extends Object { function multiple($check, $options = array()) { $defaults = array('in' => null, 'max' => null, 'min' => null); $options = array_merge($defaults, $options); - $check = array_filter($check); + $check = array_filter((array)$check); if (empty($check)) { return false; } diff --git a/cake/tests/cases/libs/validation.test.php b/cake/tests/cases/libs/validation.test.php index 0c9495d63..3f2c35c13 100644 --- a/cake/tests/cases/libs/validation.test.php +++ b/cake/tests/cases/libs/validation.test.php @@ -1782,6 +1782,8 @@ class ValidationTestCase extends CakeTestCase { $this->assertTrue(Validation::multiple(array(0, 1, 2, 3))); $this->assertTrue(Validation::multiple(array(50, 32, 22, 0))); $this->assertTrue(Validation::multiple(array('str', 'var', 'enum', 0))); + $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')));