From: Antoine Musso Date: Sun, 29 May 2011 07:00:52 +0000 (+0000) Subject: PreviousTarget is now optional when blocking a user X-Git-Tag: 1.31.0-rc.0~29872 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=477a394e5f452a29f8937ee0dce1ac9bb4fd1589;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index bf06f62adb..0b846ac0ac 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -633,7 +633,7 @@ class SpecialBlock extends SpecialPage { $status = $block->insert(); if( !$status ) { # Show form unless the user is already aware of this... - if( ( $data['PreviousTarget'] != htmlspecialchars( $block->getTarget() ) ) || !$data['Confirm'] ) { + if( ( array_key_exists('PreviousTarget', $data ) && $data['PreviousTarget'] != htmlspecialchars( $block->getTarget() ) ) || !$data['Confirm'] ) { return array( array( 'ipb_already_blocked', $block->getTarget() ) ); # Otherwise, try to update the block... } else {