diff options
author | Andrey Andreev <narf@devilix.net> | 2014-06-07 11:22:37 +0200 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2014-06-07 11:22:37 +0200 |
commit | 57f10059d7bff4cad3ff597f0e5749707b76f009 (patch) | |
tree | f5b6a55a9c5bed15f4d93fe8e8b09589f9b88951 /system/libraries/Form_validation.php | |
parent | 78af9a99a6a8585a43672b2d41ac4866301ffa00 (diff) |
Fix #3085
Diffstat (limited to 'system/libraries/Form_validation.php')
-rw-r--r-- | system/libraries/Form_validation.php | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 145692e89..1d654d9f7 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -792,27 +792,29 @@ class CI_Form_validation { if ($result === FALSE) { // Callable rules don't have named error messages - if ( ! is_callable($rule)) + if ( ! is_string($rule)) { - // Check if a custom message is defined - if (isset($this->_field_data[$row['field']]['errors'][$rule])) - { - $line = $this->_field_data[$row['field']]['errors'][$rule]; - } - elseif ( ! isset($this->_error_messages[$rule])) - { - if (FALSE === ($line = $this->CI->lang->line('form_validation_'.$rule)) - // DEPRECATED support for non-prefixed keys - && FALSE === ($line = $this->CI->lang->line($rule, FALSE))) - { - $line = 'Unable to access an error message corresponding to your field name.'; - } - } - else + return; + } + + // Check if a custom message is defined + if (isset($this->_field_data[$row['field']]['errors'][$rule])) + { + $line = $this->_field_data[$row['field']]['errors'][$rule]; + } + elseif ( ! isset($this->_error_messages[$rule])) + { + if (FALSE === ($line = $this->CI->lang->line('form_validation_'.$rule)) + // DEPRECATED support for non-prefixed keys + && FALSE === ($line = $this->CI->lang->line($rule, FALSE))) { - $line = $this->_error_messages[$rule]; + $line = 'Unable to access an error message corresponding to your field name.'; } } + else + { + $line = $this->_error_messages[$rule]; + } // Is the parameter we are inserting into the error message the name // of another field? If so we need to grab its "field label" |