From 4afd40843e83deaf3fd5293322b378f72ddf1c4c Mon Sep 17 00:00:00 2001 From: River Tarnell Date: Thu, 8 Mar 2007 03:53:32 +0000 Subject: [PATCH] need to use mb_strlen, not strlen, for article length provide stub mb_strlen for installations missing mb --- includes/GlobalFunctions.php | 7 +++++++ includes/Revision.php | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index b009a4b716..61b930d458 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -61,6 +61,13 @@ if ( !function_exists( 'mb_substr' ) ) { } } +if ( !function_exists( 'mb_strlen' ) ) { + function mb_strlen( $str, $enc = "" ) { + preg_match_all( '/./us', $str, $matches ); + return count($matches); + } +} + if ( !function_exists( 'array_diff_key' ) ) { /** * Exists in PHP 5.1.0+ diff --git a/includes/Revision.php b/includes/Revision.php index 3dcb471781..9432f0c339 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -307,7 +307,7 @@ class Revision { $this->mTitle = null; # Load on demand if needed $this->mCurrent = false; - $this->mSize = is_null($this->mText) ? null : strlen($this->mText); + $this->mSize = is_null($this->mText) ? null : mb_strlen($this->mText); } else { throw new MWException( 'Revision constructor passed invalid row format.' ); } @@ -692,7 +692,7 @@ class Revision { 'rev_user_text' => $this->mUserText, 'rev_timestamp' => $dbw->timestamp( $this->mTimestamp ), 'rev_deleted' => $this->mDeleted, - 'rev_len' => strlen($this->mText), + 'rev_len' => mb_strlen($this->mText), ), $fname ); -- 2.20.1