r101464 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101463‎ | r101464 | r101465 >
Date:09:28, 1 November 2011
Author:hashar
Status:ok (Comments)
Tags:
Comment:
checkbox could not be checked through URL parameter

On [[Special:EmailUser]], someone ought to be able to pass the checkboxes
names to overrides the default. As an example from bug 31770, the email
user page has a checkbox wpCCMe which let the user as for a copy of the
email being send. This is a user preference.

One change that checkbox state by appending ?wpCCMe=<boolean> ie:
Special:EmailUser/Hashar?wpCCMe=0
Special:EmailUser/Hashar?wpCCMe=1

The logic added in r84814 could have allowed checkboxes to be overriden
for GET form. Unfortunately, HTMLForm is mostly with the default POST.
Hence, when appending the query parameter, we would never honor it!

The fix is to still unconditionally look at the value if the form was
correctly submitted (ie has wpEditToken) and additionaly whenever
there is a checkbox name appearing in the query (wherever it is false
or true, hence the use of getVal()).

This is a regression in REL1_18. I dont think it deserves a release notes
since it is not fixing anything compared to 1.17.

Bug fixed:
==========
* (bug 31770) Allow URL parameter wpCCMe on Special:EmailUser
* (bug 30909) URL parameters for checkboxes in Special:Block no longer work
Modified paths:
  • /trunk/phase3/includes/HTMLForm.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/HTMLForm.php
@@ -1376,7 +1376,10 @@
13771377 }
13781378
13791379 // GetCheck won't work like we want for checks.
1380 - if ( $request->getCheck( 'wpEditToken' ) || $this->mParent->getMethod() != 'post' ) {
 1380+ // Fetch the value in either one of the two following case:
 1381+ // - we have a valid token (form got posted or GET forged by the user)
 1382+ // - checkbox name has a value (false or true), ie is not null
 1383+ if ( $request->getCheck( 'wpEditToken' ) || $request->getVal( $this->mName )!== null ) {
13811384 // XOR has the following truth table, which is what we want
13821385 // INVERT VALUE | OUTPUT
13831386 // true true | false

Follow-up revisions

RevisionCommit summaryAuthorDate
r102533REL1_18: MFT r101314, r101370, r101376, r101417, r101420, r101445, r101464, r...reedy17:04, 9 November 2011
r1025981.18wmf1 MFT r101445, r101464, r101666, r101802, r101860, r101990, r102297, r...reedy23:20, 9 November 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r84814Topple the last bastion of global-function-based special pages. Also fix HTM...happy-melon19:18, 26 March 2011

Comments

#Comment by Hashar (talk | contribs)   09:30, 1 November 2011

Tagging 1.18, 1.18wmf1 since it is a regression.

#Comment by Hashar (talk | contribs)   10:18, 4 November 2011

Once merged, we will be able to resolve bug 31770

Status & tagging log