Permalink
Browse files

check external method existance

  • Loading branch information...
1 parent afade1f commit b843eda89dc380108a48e5c6fc84036170edc3a2 @marcopeg marcopeg committed Oct 25, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/Cake/Model/Validator/CakeValidationRule.php
@@ -280,8 +280,10 @@ public function process($field, &$data, &$methods) {
$location = 'Model/Validation';
if ( $plugin ) $location = $plugin . '.' . $location;
App::uses($className, $location);
- if (class_exists($className)) {
+ if (class_exists($className) && method_exists($className, $method)) {
$this->_valid = call_user_func_array(array($className, $method), $this->_ruleParams);
+ } else {
+ $this->_valid = false;
}
} elseif (is_string($validator['rule'])) {
$this->_valid = preg_match($this->_rule, $data[$field]);

0 comments on commit b843eda

Please sign in to comment.