summaryrefslogtreecommitdiffstats
path: root/system/libraries/Validation.php
diff options
context:
space:
mode:
authorRick Ellis <rick.ellis@ellislab.com>2008-10-17 08:26:15 +0200
committerRick Ellis <rick.ellis@ellislab.com>2008-10-17 08:26:15 +0200
commit1cdfec8f63974b4b7827213fe44314d7b4328542 (patch)
tree24473178eed0a6c5ded3129ac2fa0385577ca367 /system/libraries/Validation.php
parent63c361dfd8693aa080acfe81b3e4edf82c5499ca (diff)
Added support for mb_strlen, as per bug report #4778
Diffstat (limited to 'system/libraries/Validation.php')
-rw-r--r--system/libraries/Validation.php25
1 files changed, 23 insertions, 2 deletions
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;
}