Index: branches/5.2.x/core/kernel/utility/validator.php
===================================================================
diff -u -N -r16235 -r16569
--- branches/5.2.x/core/kernel/utility/validator.php (.../validator.php) (revision 16235)
+++ branches/5.2.x/core/kernel/utility/validator.php (.../validator.php) (revision 16569)
@@ -1,6 +1,6 @@
Application->isAdmin ? 'la_fld_' . $field : 'lu_fld_' . $field;
- $params['field'] = $this->Application->Phrase($field_phrase);
-
- foreach ( $params as $param_name => $param_value ) {
- $msg = str_replace('{' . $param_name . '}', $param_value, $msg, $replacement_count);
+ if ( $params && preg_match('/%[^\s]/', $msg) ) {
+ $msg = vsprintf($msg, array_values($params));
}
+ else {
+ $field_phrase = $this->Application->isAdmin ? 'la_fld_' . $field : 'lu_fld_' . $field;
+ $params['field'] = $this->Application->Phrase($field_phrase);
- if ( strpos($msg, '%s') !== false ) {
- trigger_error('Unexpected "%s" in field "' . $field . '" validation error message (pseudo: "' . $error_pseudo . '") in "' . $this->dataSource->Prefix . '" unit', E_USER_WARNING);
+ foreach ( $params as $param_name => $param_value ) {
+ $msg = str_replace('{' . $param_name . '}', $param_value, $msg);
+ }
}
return $msg;