Commit r2394: https://sourceforge.net/p/mrbs/code/2394/

------------------------------------------------------------------------
r2394 | cimorrison | 2012-09-05 16:57:39 +0100 (Wed, 05 Sep 2012) | 1 line
Changed paths:
   M /mrbs/trunk/web/language.inc

Made utf8_bytecount() PHP4-safe.   See SF bugs 243.
------------------------------------------------------------------------

Index: mrbs/trunk/web/language.inc
===================================================================
--- mrbs/trunk/web/language.inc (revision 2393)
+++ mrbs/trunk/web/language.inc (revision 2394)
@@ -1081,7 +1081,16 @@
 // _bytes_
 function utf8_bytecount($str)
 {
-  return count(str_split($str));
+  // We cannot rely on strlen() to return the number of bytes because it might
+  // have been overloaded by mb_strlen() which returns characters
+  if (function_exists('mb_strlen'))
+  {
+    return mb_strlen($str, '8bit');
+  }
+  else
+  {
+    return strlen($str);
+  }
 }
 
 

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to