mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Adding array cast to $check. Fixes issues when non arrays are validated 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
This commit is contained in:
parent
b0e23ddc7d
commit
cc88680d17
2 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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')));
|
||||
|
|
Loading…
Add table
Reference in a new issue