From: umherirrender Date: Mon, 28 Jul 2014 17:25:49 +0000 (+0200) Subject: Truncate block reason for whole multibyte characters X-Git-Tag: 1.31.0-rc.0~14718^2 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=135fcc4dc75479170f8fb130f467d2b77c6cdddf;p=lhc%2Fweb%2Fwiklou.git Truncate block reason for whole multibyte characters This applies to Special:BlockList, or to the block message shown to the user, or API results. Log is not effected, because it already truncates on its own. Change-Id: I0a8bae5f43fd1604034d65e96c9461a9f83c0b0a --- diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index f8b2e8d969..3297c17a6b 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -600,7 +600,7 @@ class SpecialBlock extends FormSpecialPage { * @return bool|string */ public static function processForm( array $data, IContextSource $context ) { - global $wgBlockAllowsUTEdit, $wgHideUserContribLimit; + global $wgBlockAllowsUTEdit, $wgHideUserContribLimit, $wgContLang; $performer = $context->getUser(); @@ -687,7 +687,8 @@ class SpecialBlock extends FormSpecialPage { $block = new Block(); $block->setTarget( $target ); $block->setBlocker( $performer ); - $block->mReason = $data['Reason'][0]; + # Truncate reason for whole multibyte characters + $block->mReason = $wgContLang->truncate( $data['Reason'][0], 255 ); $block->mExpiry = self::parseExpiryInput( $data['Expiry'] ); $block->prevents( 'createaccount', $data['CreateAccount'] ); $block->prevents( 'editownusertalk', ( !$wgBlockAllowsUTEdit || $data['DisableUTEdit'] ) );