summaryrefslogtreecommitdiffstats
path: root/system/libraries/Form_validation.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-05-20 08:58:08 +0200
committerAndrey Andreev <narf@devilix.net>2014-05-20 08:58:08 +0200
commit69c56441df49280cb79c67b80ecafa4f52e4453f (patch)
tree65825a177643709dcdb82a9512bab690be5ad921 /system/libraries/Form_validation.php
parent9e9d86ba77b6aead9daec720bb1444841527e0c7 (diff)
[ci skip] Fix error notices in FV when trying to lookup error msgs for closures
Diffstat (limited to 'system/libraries/Form_validation.php')
-rw-r--r--system/libraries/Form_validation.php32
1 files changed, 18 insertions, 14 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 2f072343d..dc5d17fb3 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -791,23 +791,27 @@ class CI_Form_validation {
// Did the rule test negatively? If so, grab the error.
if ($result === FALSE)
{
- // 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]))
+ // Callable rules don't have named error messages
+ if ( ! is_callable($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)))
+ // Check if a custom message is defined
+ if (isset($this->_field_data[$row['field']]['errors'][$rule]))
{
- $line = 'Unable to access an error message corresponding to your field name.';
+ $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
+ {
+ $line = $this->_error_messages[$rule];
}
- }
- else
- {
- $line = $this->_error_messages[$rule];
}
// Is the parameter we are inserting into the error message the name