From: Greg Sabino Mullane Date: Mon, 4 Feb 2008 17:33:49 +0000 (+0000) Subject: When putting usernames in SQL comments, truncate using mb_ functions for utf username... X-Git-Tag: 1.31.0-rc.0~49620 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=157fd5bd948e2c1b7c1b5c42d9e1e085fc184b50;p=lhc%2Fweb%2Fwiklou.git When putting usernames in SQL comments, truncate using mb_ functions for utf usernames. Bug 12735. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2fa17f3a1a..c2230b6136 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -358,6 +358,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 12880) wfLoadExtensionMessages does not use $fallback from MessagesXx.php * (bug 12885) Correction for Russian convertPlural function * (bug 12768) Make DatabasePostgres->hasContraint() schema aware. +* (bug 12735) Truncate usernames in comments using mb_ functions. == Parser changes in 1.12 == diff --git a/includes/Database.php b/includes/Database.php index 0548b7cec3..69664301c6 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -745,8 +745,8 @@ class Database { global $wgUser; if ( is_object( $wgUser ) && !($wgUser instanceof StubObject) ) { $userName = $wgUser->getName(); - if ( strlen( $userName ) > 15 ) { - $userName = substr( $userName, 0, 15 ) . '...'; + if ( mb_strlen( $userName ) > 15 ) { + $userName = mb_substr( $userName, 0, 15 ) . '...'; } $userName = str_replace( '/', '', $userName ); } else {