r23389 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23388‎ | r23389 | r23390 >
Date:15:02, 25 June 2007
Author:brion
Status:old
Tags:
Comment:
* (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.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/includes/SpecialPreferences.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -3812,7 +3812,7 @@
38133813 $nickname = $user->getOption( 'nickname' );
38143814 $nickname = $nickname === '' ? $username : $nickname;
38153815
3816 - if( strlen( $nickname ) > $wgMaxSigChars ) {
 3816+ if( mb_strlen( $nickname ) > $wgMaxSigChars ) {
38173817 $nickname = $username;
38183818 wfDebug( __METHOD__ . ": $username has overlong signature.\n" );
38193819 } elseif( $user->getBoolOption( 'fancysig' ) !== false ) {
Index: trunk/phase3/includes/SpecialPreferences.php
@@ -242,7 +242,7 @@
243243
244244 # Validate the signature and clean it up as needed
245245 global $wgMaxSigChars;
246 - if( strlen( $this->mNick ) > $wgMaxSigChars ) {
 246+ if( mb_strlen( $this->mNick ) > $wgMaxSigChars ) {
247247 global $wgLang;
248248 $this->mainPrefsForm( 'error',
249249 wfMsg( 'badsiglength', $wgLang->formatNum( $wgMaxSigChars ) ) );
@@ -610,7 +610,7 @@
611611 }
612612
613613 global $wgParser, $wgMaxSigChars;
614 - if( strlen( $this->mNick ) > $wgMaxSigChars ) {
 614+ if( mb_strlen( $this->mNick ) > $wgMaxSigChars ) {
615615 $invalidSig = $this->tableRow(
616616 ' ',
617617 Xml::element( 'span', array( 'class' => 'error' ),
@@ -632,10 +632,10 @@
633633 Xml::input( 'wpNick', 25, $this->mNick,
634634 array(
635635 'id' => 'wpNick',
636 - // Note: $wgMaxSigChars is currently enforced in UTF-8 bytes,
637 - // but 'maxlength' attribute is enforced in characters.
638 - // It's still possible to put in an overlong string
639 - // 'legitimately' by typing non-ASCII chars.
 636+ // Note: $wgMaxSigChars is enforced in Unicode characters,
 637+ // both on the backend and now in the browser.
 638+ // Badly-behaved requests may still try to submit
 639+ // an overlong string, however.
640640 'maxlength' => $wgMaxSigChars ) )
641641 ) .
642642 $invalidSig .
Index: trunk/phase3/includes/DefaultSettings.php
@@ -857,7 +857,7 @@
858858
859859 $wgShowIPinHeader = true; # For non-logged in users
860860 $wgMaxNameChars = 255; # Maximum number of bytes in username
861 -$wgMaxSigChars = 255; # Maximum number of bytes in signature
 861+$wgMaxSigChars = 255; # Maximum number of Unicode characters in signature
862862 $wgMaxArticleSize = 2048; # Maximum article size in kilobytes
863863
864864 $wgExtraSubtitle = '';
Index: trunk/phase3/RELEASE-NOTES
@@ -101,7 +101,9 @@
102102 enabled by default.
103103 * Added option to install to MyISAM
104104 * (bug 9250) Remove hardcoded minimum image name length of three characters
 105+* (bug 10338) Enforce signature length limit in Unicode characters instead of bytes
105106
 107+
106108 == Bugfixes since 1.10 ==
107109
108110 * (bug 9712) Use Arabic comma in date/time formats for Arabic and Farsi

Follow-up revisions

RevisionCommit summaryAuthorDate
r23407Merged revisions 23203-23405 via svnmerge from...david23:00, 25 June 2007

Status & tagging log