(bug 33156) Special:block didn't let you confirm blocking yourself if using non-norma...
authorBrian Wolff <bawolff@users.mediawiki.org>
Tue, 20 Dec 2011 10:15:18 +0000 (10:15 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Tue, 20 Dec 2011 10:15:18 +0000 (10:15 +0000)
Was comparing the normalized name to the non-normalized name that gets inserted into the form, since
request variables from previous request override form defaults.

RELEASE-NOTES-1.19
includes/specials/SpecialBlock.php

index 55cc0c3..4f90d99 100644 (file)
@@ -189,6 +189,8 @@ production.
   causes the first log type requested to be removed but not the others
 * Use separate message ('prefixindex-namespace') for title of
   Special:PrefixIndex rather then re-using Special:AllPages's allinnamespace
+* (bug 33156) Special:Block now allows you to confirm you want to block yourself
+  when using non-normalized username
 
 === API changes in 1.19 ===
 * (bug 19838) siprop=interwikimap can now use the interwiki cache.
index fab295a..eac382a 100644 (file)
@@ -565,9 +565,13 @@ class SpecialBlock extends FormSpecialPage {
 
                        # Give admins a heads-up before they go and block themselves.  Much messier
                        # to do this for IPs, but it's pretty unlikely they'd ever get the 'block'
-                       # permission anyway, although the code does allow for it
+                       # permission anyway, although the code does allow for it.
+                       # Note: Important to use $target instead of $data['Target']
+                       # since both $data['PreviousTarget'] and $target are normalized
+                       # but $data['target'] gets overriden by (non-normalized) request variable
+                       # from previous request.
                        if( $target === $performer->getName() &&
-                               ( $data['PreviousTarget'] !== $data['Target'] || !$data['Confirm'] ) )
+                               ( $data['PreviousTarget'] !== $target || !$data['Confirm'] ) )
                        {
                                return array( 'ipb-blockingself' );
                        }