* (bug 6997) Link from Special:log/block to unblock form
* (bug 9117) Link from Special:log/delete to undelete form
* Link from Special:log/protect to change protection form
+* Fix fallback implementation of mb_strlen so it works and isn't insanely
+ slow for large strings, since it's used for page edit lengths
+
== Languages updated ==
}
if ( !function_exists( 'mb_strlen' ) ) {
- function mb_strlen( $str, $enc = "" ) {
- preg_match_all( '/./us', $str, $matches );
- return count($matches);
+ /**
+ * Fallback implementation of mb_strlen, hardcoded to UTF-8.
+ * @param string $str
+ * @param string $enc optional encoding; ignored
+ * @return int
+ */
+ function new_mb_strlen( $str, $enc="" ) {
+ $counts = count_chars( $str );
+ $total = 0;
+
+ // Count ASCII bytes
+ for( $i = 0; $i < 0x80; $i++ ) {
+ $total += $counts[$i];
+ }
+
+ // Count multibyte sequence heads
+ for( $i = 0xc0; $i < 0xff; $i++ ) {
+ $total += $counts[$i];
+ }
+ return $total;
}
}