diff --git a/src/Valitron/Validator.php b/src/Valitron/Validator.php index e08be03..0f97ace 100644 --- a/src/Valitron/Validator.php +++ b/src/Valitron/Validator.php @@ -1199,6 +1199,9 @@ class Validator foreach ($rules as $ruleType => $params) { if (is_array($params)) { foreach ($params as $innerParams) { + if (! is_array($innerParams)){ + $innerParams = (array) $innerParams; + } array_unshift($innerParams, $ruleType); call_user_func_array(array($this, 'rule'), $innerParams); } diff --git a/tests/Valitron/ValidateTest.php b/tests/Valitron/ValidateTest.php index dbb048b..e6794d7 100644 --- a/tests/Valitron/ValidateTest.php +++ b/tests/Valitron/ValidateTest.php @@ -892,6 +892,17 @@ class ValidateTest extends BaseTestCase $this->assertEquals($v1->errors(), $v2->errors()); } + public function testMalformedBulkRules(){ + $v = new Validator(); + $v->rules( + array( + 'required'=>array('foo', 'bar') + ) + ); + + $this->assertFalse($v->validate()); + } + public function testCustomLabelInMessage() { $v = new Valitron\Validator(array());