r89087 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89086‎ | r89087 | r89088 >
Date:07:00, 29 May 2011
Author:hashar
Status:ok (Comments)
Tags:
Comment:
PreviousTarget is now optional when blocking a user

The API does not seem to give a PreviousTarget field all the time.
This patch also fix the an assertion for ApiBlockTest::testMakeNormalBlock
Modified paths:
  • /trunk/phase3/includes/specials/SpecialBlock.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialBlock.php
@@ -633,7 +633,7 @@
634634 $status = $block->insert();
635635 if( !$status ) {
636636 # Show form unless the user is already aware of this...
637 - if( ( $data['PreviousTarget'] != htmlspecialchars( $block->getTarget() ) ) || !$data['Confirm'] ) {
 637+ if( ( array_key_exists('PreviousTarget', $data ) && $data['PreviousTarget'] != htmlspecialchars( $block->getTarget() ) ) || !$data['Confirm'] ) {
638638 return array( array( 'ipb_already_blocked', $block->getTarget() ) );
639639 # Otherwise, try to update the block...
640640 } else {

Sign-offs

UserFlagDate
Nikerabbitinspected12:41, 14 June 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r90693Code style cleanups, use strict comparison with $data['PreviousTarget'] per CRaaron07:49, 24 June 2011

Comments

#Comment by Nikerabbit (talk | contribs)   12:41, 14 June 2011

Some reason isset() cannot be used here? I'd prefer !== because we know both should be strings to match.

Status & tagging log