Commit 7b73fdff by Alexander Makarov

Better validation rules validity check

parent a72d2f53
...@@ -329,7 +329,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess ...@@ -329,7 +329,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
foreach ($this->rules() as $rule) { foreach ($this->rules() as $rule) {
if ($rule instanceof Validator) { if ($rule instanceof Validator) {
$validators->add($rule); $validators->add($rule);
} elseif (isset($rule[0], $rule[1])) { // attributes, validator type } elseif (is_array($rule) && isset($rule[0], $rule[1])) { // attributes, validator type
$validator = Validator::createValidator($rule[1], $this, $rule[0], array_slice($rule, 2)); $validator = Validator::createValidator($rule[1], $this, $rule[0], array_slice($rule, 2));
$validators->add($validator); $validators->add($validator);
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment