Author: coudot
Date: 2010-07-17 15:59:47 +0200 (Sat, 17 Jul 2010)
New Revision: 91

Modified:
   self-service-password/trunk/functions.inc.php
Log:
Decode UTF8 string to know its real length (references #189)

Modified: self-service-password/trunk/functions.inc.php
===================================================================
--- self-service-password/trunk/functions.inc.php       2010-07-17 13:47:32 UTC 
(rev 90)
+++ self-service-password/trunk/functions.inc.php       2010-07-17 13:59:47 UTC 
(rev 91)
@@ -128,7 +128,7 @@
 
     $result = "";
 
-    $length = strlen($password);
+    $length = strlen(utf8_decode($password));
     preg_match_all("/[a-z]/", $password, $lower_res);
     $lower = count( $lower_res[0] );
     preg_match_all("/[A-Z]/", $password, $upper_res);
@@ -179,7 +179,7 @@
     # Transform password value
     if ( $ad_mode ) {
         $password = "\"" . $password . "\"";
-        $len = strlen($password);
+        $len = strlen(utf8_decode($password));
         for ($i = 0; $i < $len; $i++){
             $password .= "{$password{$i}}\000";
         }

_______________________________________________
ltb-changes mailing list
[email protected]
http://lists.ltb-project.org/listinfo/ltb-changes

Reply via email to