* (bug 10338) Enforce signature length limit in Unicode characters instead of bytes
Uses mb_strlen(), which we already have a fallback function for if mbstring extension isn't present.
This commit is contained in:
parent
e94ea4c89b
commit
c52af0da6d
4 changed files with 10 additions and 8 deletions
|
|
@ -101,6 +101,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
|
|||
enabled by default.
|
||||
* Added option to install to MyISAM
|
||||
* (bug 9250) Remove hardcoded minimum image name length of three characters
|
||||
* (bug 10338) Enforce signature length limit in Unicode characters instead of bytes
|
||||
|
||||
|
||||
== Bugfixes since 1.10 ==
|
||||
|
||||
|
|
|
|||
|
|
@ -857,7 +857,7 @@ $wgRedirectSources = false;
|
|||
|
||||
$wgShowIPinHeader = true; # For non-logged in users
|
||||
$wgMaxNameChars = 255; # Maximum number of bytes in username
|
||||
$wgMaxSigChars = 255; # Maximum number of bytes in signature
|
||||
$wgMaxSigChars = 255; # Maximum number of Unicode characters in signature
|
||||
$wgMaxArticleSize = 2048; # Maximum article size in kilobytes
|
||||
|
||||
$wgExtraSubtitle = '';
|
||||
|
|
|
|||
|
|
@ -3812,7 +3812,7 @@ class Parser
|
|||
$nickname = $user->getOption( 'nickname' );
|
||||
$nickname = $nickname === '' ? $username : $nickname;
|
||||
|
||||
if( strlen( $nickname ) > $wgMaxSigChars ) {
|
||||
if( mb_strlen( $nickname ) > $wgMaxSigChars ) {
|
||||
$nickname = $username;
|
||||
wfDebug( __METHOD__ . ": $username has overlong signature.\n" );
|
||||
} elseif( $user->getBoolOption( 'fancysig' ) !== false ) {
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ class PreferencesForm {
|
|||
|
||||
# Validate the signature and clean it up as needed
|
||||
global $wgMaxSigChars;
|
||||
if( strlen( $this->mNick ) > $wgMaxSigChars ) {
|
||||
if( mb_strlen( $this->mNick ) > $wgMaxSigChars ) {
|
||||
global $wgLang;
|
||||
$this->mainPrefsForm( 'error',
|
||||
wfMsg( 'badsiglength', $wgLang->formatNum( $wgMaxSigChars ) ) );
|
||||
|
|
@ -610,7 +610,7 @@ class PreferencesForm {
|
|||
}
|
||||
|
||||
global $wgParser, $wgMaxSigChars;
|
||||
if( strlen( $this->mNick ) > $wgMaxSigChars ) {
|
||||
if( mb_strlen( $this->mNick ) > $wgMaxSigChars ) {
|
||||
$invalidSig = $this->tableRow(
|
||||
' ',
|
||||
Xml::element( 'span', array( 'class' => 'error' ),
|
||||
|
|
@ -632,10 +632,10 @@ class PreferencesForm {
|
|||
Xml::input( 'wpNick', 25, $this->mNick,
|
||||
array(
|
||||
'id' => 'wpNick',
|
||||
// Note: $wgMaxSigChars is currently enforced in UTF-8 bytes,
|
||||
// but 'maxlength' attribute is enforced in characters.
|
||||
// It's still possible to put in an overlong string
|
||||
// 'legitimately' by typing non-ASCII chars.
|
||||
// Note: $wgMaxSigChars is enforced in Unicode characters,
|
||||
// both on the backend and now in the browser.
|
||||
// Badly-behaved requests may still try to submit
|
||||
// an overlong string, however.
|
||||
'maxlength' => $wgMaxSigChars ) )
|
||||
) .
|
||||
$invalidSig .
|
||||
|
|
|
|||
Loading…
Reference in a new issue