@@ -791,23 +791,27 @@ protected function _execute($row, $rules, $postdata = NULL, $cycles = 0)
791
791
// Did the rule test negatively? If so, grab the error.
792
792
if ($ result === FALSE )
793
793
{
794
- // Check if a custom message is defined
795
- if (isset ($ this ->_field_data [$ row ['field ' ]]['errors ' ][$ rule ]))
796
- {
797
- $ line = $ this ->_field_data [$ row ['field ' ]]['errors ' ][$ rule ];
798
- }
799
- elseif ( ! isset ($ this ->_error_messages [$ rule ]))
794
+ // Callable rules don't have named error messages
795
+ if ( ! is_callable ($ rule ))
800
796
{
801
- if (FALSE === ($ line = $ this ->CI ->lang ->line ('form_validation_ ' .$ rule ))
802
- // DEPRECATED support for non-prefixed keys
803
- && FALSE === ($ line = $ this ->CI ->lang ->line ($ rule , FALSE )))
797
+ // Check if a custom message is defined
798
+ if (isset ($ this ->_field_data [$ row ['field ' ]]['errors ' ][$ rule ]))
804
799
{
805
- $ line = 'Unable to access an error message corresponding to your field name. ' ;
800
+ $ line = $ this ->_field_data [$ row ['field ' ]]['errors ' ][$ rule ];
801
+ }
802
+ elseif ( ! isset ($ this ->_error_messages [$ rule ]))
803
+ {
804
+ if (FALSE === ($ line = $ this ->CI ->lang ->line ('form_validation_ ' .$ rule ))
805
+ // DEPRECATED support for non-prefixed keys
806
+ && FALSE === ($ line = $ this ->CI ->lang ->line ($ rule , FALSE )))
807
+ {
808
+ $ line = 'Unable to access an error message corresponding to your field name. ' ;
809
+ }
810
+ }
811
+ else
812
+ {
813
+ $ line = $ this ->_error_messages [$ rule ];
806
814
}
807
- }
808
- else
809
- {
810
- $ line = $ this ->_error_messages [$ rule ];
811
815
}
812
816
813
817
// Is the parameter we are inserting into the error message the name
0 commit comments