From 1cdfec8f63974b4b7827213fe44314d7b4328542 Mon Sep 17 00:00:00 2001 From: Rick Ellis Date: Fri, 17 Oct 2008 06:26:15 +0000 Subject: Added support for mb_strlen, as per bug report #4778 --- system/libraries/Validation.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php index 20bb6bdb7..a463202eb 100644 --- a/system/libraries/Validation.php +++ b/system/libraries/Validation.php @@ -46,6 +46,12 @@ class CI_Validation { function CI_Validation() { $this->CI =& get_instance(); + + if (function_exists('mb_internal_encoding')) + { + mb_internal_encoding($this->CI->config->item('charset')); + } + log_message('debug', "Validation Class Initialized"); } @@ -431,7 +437,12 @@ class CI_Validation { { return FALSE; } - + + if (function_exists('mb_strlen')) + { + return (mb_strlen($str) < $val) ? FALSE : TRUE; + } + return (strlen($str) < $val) ? FALSE : TRUE; } @@ -451,7 +462,12 @@ class CI_Validation { { return FALSE; } - + + if (function_exists('mb_strlen')) + { + return (mb_strlen($str) > $val) ? FALSE : TRUE; + } + return (strlen($str) > $val) ? FALSE : TRUE; } @@ -472,6 +488,11 @@ class CI_Validation { return FALSE; } + if (function_exists('mb_strlen')) + { + return (mb_strlen($str) != $val) ? FALSE : TRUE; + } + return (strlen($str) != $val) ? FALSE : TRUE; } -- cgit v1.2.3-24-g4f1b