(bug 28649) use $wgContLang->truncate on log action comments to avoid half eaten...
authorBrian Wolff <bawolff@users.mediawiki.org>
Wed, 24 Aug 2011 23:47:54 +0000 (23:47 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Wed, 24 Aug 2011 23:47:54 +0000 (23:47 +0000)
Patch by Umherirrender.

RELEASE-NOTES-1.19
includes/LogPage.php

index 87e66c1..a7ce798 100644 (file)
@@ -70,6 +70,8 @@ production.
   warnings/notices to be thrown.
 * (bug 30335) Fix for HTMLForms using GET breaking when non-friendly URLs are
   used
+* (bug 28649) Avoiding half truncated multi-byte unicode characters when 
+  truncating log comments.
 
 === API changes in 1.19 ===
 * (bug 19838) siprop=interwikimap can now use the interwiki cache.
index 5155d9a..c810b24 100644 (file)
@@ -416,6 +416,8 @@ class LogPage {
         * @param $doer User object: the user doing the action
         */
        public function addEntry( $action, $target, $comment, $params = array(), $doer = null ) {
+               global $wgContLang;
+
                if ( !is_array( $params ) ) {
                        $params = array( $params );
                }
@@ -424,6 +426,9 @@ class LogPage {
                        $comment = '';
                }
 
+               # Truncate for whole multibyte characters.
+               $comment = $wgContLang->truncate( $comment, 255 );
+
                $this->action = $action;
                $this->target = $target;
                $this->comment = $comment;