Truncate null revision comment for whole multibyte characters
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 20 Feb 2015 21:19:53 +0000 (22:19 +0100)
committerUmherirrender <umherirrender_de.wp@web.de>
Thu, 12 Mar 2015 18:17:45 +0000 (18:17 +0000)
Added a truncate for multibyte characters to Revision::newNullRevision.
This avoids broken characters for long comment, mostly the comment for
move or protection in the history.
The whole comment is still visible on Special:Log.

Bug: T85700
Change-Id: Ie0863261484ee99006407c12c3a920ea476925e3

includes/Revision.php

index d535028..327ff45 100644 (file)
@@ -1566,7 +1566,7 @@ class Revision implements IDBAccessObject {
         * @return Revision|null Revision or null on error
         */
        public static function newNullRevision( $dbw, $pageId, $summary, $minor, $user = null ) {
-               global $wgContentHandlerUseDB;
+               global $wgContentHandlerUseDB, $wgContLang;
 
                $fields = array( 'page_latest', 'page_namespace', 'page_title',
                                                'rev_text_id', 'rev_len', 'rev_sha1' );
@@ -1591,6 +1591,9 @@ class Revision implements IDBAccessObject {
                                $user = $wgUser;
                        }
 
+                       // Truncate for whole multibyte characters
+                       $summary = $wgContLang->truncate( $summary, 255 );
+
                        $row = array(
                                'page'       => $pageId,
                                'user_text'  => $user->getName(),