Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed bug in model validation translate #628

Merged
merged 1 commit into from

2 participants

@tigrang

Validation rules like:

'name' => array(
    'rule' => array('multiple', array('min' => 1, 'max' => 7)),
    'message' => 'The course must meet one day, right?',
),

would throw a warning because it would try to translate array('min' => 1, 'max' => 7) so I added a check to see if the arg was a string first.

@ADmad ADmad merged commit 9a693f9 into cakephp:2.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 27, 2012
  1. @tigrang
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/Cake/Model/Model.php
View
4 lib/Cake/Model/Model.php
@@ -3191,7 +3191,9 @@ public function invalidFields($options = array()) {
}
if (!empty($args)) {
foreach ($args as $k => $arg) {
- $args[$k] = __d($validationDomain, $arg);
+ if (is_string($arg)) {
+ $args[$k] = __d($validationDomain, $arg);
+ }
}
}
$message = __d($validationDomain, $message, $args);
Something went wrong with that request. Please try again.