Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding array cast to $check. Fixes issues when non arrays are validat…

…ed with Validation::multiple. Tests added. Fixes #5986

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7974 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information...
commit cc88680d172e5372308bb7ee950975b6fd206001 1 parent b0e23dd
Mark Story markstory authored
2  cake/libs/validation.php
View
@@ -632,7 +632,7 @@ function money($check, $symbolPosition = 'left') {
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;
}
2  cake/tests/cases/libs/validation.test.php
View
@@ -1782,6 +1782,8 @@ function testMultiple() {
$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')));
Please sign in to comment.
Something went wrong with that request. Please try again.