MDL-6122 truncate_userinfo() has to use unicode aware functions
authorPetr Skoda <skodak@moodle.org>
Wed, 6 Oct 2010 19:12:49 +0000 (19:12 +0000)
committerPetr Skoda <skodak@moodle.org>
Wed, 6 Oct 2010 19:12:49 +0000 (19:12 +0000)
lib/moodlelib.php

index 7dc96cd..bf96cc5 100644 (file)
@@ -3496,10 +3496,11 @@ function truncate_userinfo($info) {
                     'url'         => 255,
                     );
 
                     'url'         => 255,
                     );
 
+    $textlib = textlib_get_instance();
     // apply where needed
     foreach (array_keys($info) as $key) {
         if (!empty($limit[$key])) {
     // apply where needed
     foreach (array_keys($info) as $key) {
         if (!empty($limit[$key])) {
-            $info[$key] = trim(substr($info[$key],0, $limit[$key]));
+            $info[$key] = trim($textlib->substr($info[$key],0, $limit[$key]));
         }
     }
 
         }
     }