From d4eec9f3638cc31dc8965f929b74a2b3b201b8b7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 14 Dec 2012 11:07:13 +0200 Subject: Fix issue #539 Form validation language line keys were not prefixed. They are now prefixed with 'form_validation_' in order to avoid collisions. The old keys will still work if a prefixed match is not found, but are DEPRECATED and will be removed in the next major version. Also added upgrade notes and changelog entries for the new error message format from PR #961. --- system/libraries/Form_validation.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'system/libraries/Form_validation.php') diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index ecd5b18df..68534251b 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -609,7 +609,9 @@ class CI_Form_validation { { $line = $this->_error_messages[$type]; } - elseif (FALSE === ($line = $this->CI->lang->line($type))) + elseif (FALSE === ($line = $this->CI->lang->line('form_validation_'.$type)) + // DEPRECATED support for non-prefixed keys + && FALSE === ($line = $this->CI->lang->line($type, FALSE))) { $line = 'The field was not set'; } @@ -749,7 +751,9 @@ class CI_Form_validation { { if ( ! isset($this->_error_messages[$rule])) { - if (FALSE === ($line = $this->CI->lang->line($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.'; } @@ -797,7 +801,9 @@ class CI_Form_validation { if (sscanf($fieldname, 'lang:%s', $line) === 1) { // Were we able to translate the field name? If not we use $line - if (FALSE === ($fieldname = $this->CI->lang->line($line))) + if (FALSE === ($fieldname = $this->CI->lang->line('form_validation_'.$line)) + // DEPRECATED support for non-prefixed keys + && FALSE === ($fieldname = $this->CI->lang->line($line, FALSE))) { return $line; } @@ -807,7 +813,7 @@ class CI_Form_validation { } // -------------------------------------------------------------------- - + /** * Build an error message using the field and param. * -- cgit v1.2.3-24-g4f1b