From: umherirrender Date: Fri, 20 Feb 2015 21:19:53 +0000 (+0100) Subject: Truncate null revision comment for whole multibyte characters X-Git-Tag: 1.31.0-rc.0~12064^2 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27votes%27%2C%20votes=%27waiting%27%29%20%7D%7D?a=commitdiff_plain;h=fa95cb9d73f7de7f7e90c11fa8c00ca955dba0d1;p=lhc%2Fweb%2Fwiklou.git Truncate null revision comment for whole multibyte characters 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 --- diff --git a/includes/Revision.php b/includes/Revision.php index d535028a92..327ff45aa1 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -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(),