Permalink
Browse files

Making sure the Validation class exists before checking methods on it

  • Loading branch information...
1 parent 7b58636 commit 67d18b0c59c795da5e878360af68faf3ff75d51f @lorenzo lorenzo committed Jan 7, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/Cake/Model/Model.php
View
@@ -3078,7 +3078,7 @@ public function invalidFields($options = array()) {
$ruleParams[] = $validator;
$ruleParams[0] = array($fieldName => $ruleParams[0]);
$valid = $this->Behaviors->dispatchMethod($this, $rule, $ruleParams);
- } elseif (method_exists('Validation', $rule)) {
+ } elseif (class_exists('Validation') && method_exists('Validation', $rule)) {
$valid = call_user_func_array(array('Validation', $rule), $ruleParams);
} elseif (!is_array($validator['rule'])) {
$valid = preg_match($rule, $data[$fieldName]);

0 comments on commit 67d18b0

Please sign in to comment.