From 878c7da630640caa4f3e2035dc69f477f05678bf Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Tue, 16 Feb 2010 21:59:16 +0000 Subject: [PATCH] Followup to r62557 as per Roans comment --- includes/api/ApiBase.php | 4 ++-- includes/api/ApiBlock.php | 2 +- includes/api/ApiDelete.php | 2 +- includes/api/ApiEditPage.php | 2 +- includes/api/ApiEmailUser.php | 2 +- includes/api/ApiImport.php | 2 +- includes/api/ApiMain.php | 5 ++--- includes/api/ApiMove.php | 2 +- includes/api/ApiPatrol.php | 2 +- includes/api/ApiRollback.php | 2 +- includes/api/ApiUnblock.php | 2 +- includes/api/ApiUndelete.php | 2 +- includes/api/ApiUpload.php | 2 +- 13 files changed, 15 insertions(+), 16 deletions(-) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 73ae1ab5cf..0f15eca64d 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -970,7 +970,7 @@ abstract class ApiBase { } /** - * Returns the token salt if there is one, null if the module doesn't require a salt, else false if the module doesn't need a token + * Returns the token salt if there is one, '' if the module doesn't require a salt, else false if the module doesn't need a token * @returns bool */ public function getTokenSalt() { @@ -997,7 +997,7 @@ abstract class ApiBase { $ret[] = array ( 'writedisabled' ); } - if ( $this->getTokenSalt() != false ) { + if ( $this->getTokenSalt() !== false ) { $ret[] = array( 'missingparam', 'token' ); $ret[] = array( 'sessionfailure' ); } diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php index 27895aa183..5d515898b8 100644 --- a/includes/api/ApiBlock.php +++ b/includes/api/ApiBlock.php @@ -166,7 +166,7 @@ class ApiBlock extends ApiBase { } public function getTokenSalt() { - return null; + return ''; } protected function getExamples() { diff --git a/includes/api/ApiDelete.php b/includes/api/ApiDelete.php index 89ee8312e4..40f487fc37 100644 --- a/includes/api/ApiDelete.php +++ b/includes/api/ApiDelete.php @@ -218,7 +218,7 @@ class ApiDelete extends ApiBase { } public function getTokenSalt() { - return null; + return ''; } protected function getExamples() { diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index 3a52405e81..e85da4b07f 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -458,7 +458,7 @@ class ApiEditPage extends ApiBase { } public function getTokenSalt() { - return null; + return ''; } protected function getExamples() { diff --git a/includes/api/ApiEmailUser.php b/includes/api/ApiEmailUser.php index 1a735b7306..0c29c6fb25 100644 --- a/includes/api/ApiEmailUser.php +++ b/includes/api/ApiEmailUser.php @@ -113,7 +113,7 @@ class ApiEmailUser extends ApiBase { } public function getTokenSalt() { - return null; + return ''; } protected function getExamples() { diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php index 163f2eb7a1..2d0cfb34ba 100644 --- a/includes/api/ApiImport.php +++ b/includes/api/ApiImport.php @@ -150,7 +150,7 @@ class ApiImport extends ApiBase { } public function getTokenSalt() { - return null; + return ''; } protected function getExamples() { diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index fa87e57ce2..7add216e66 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -416,14 +416,13 @@ class ApiMain extends ApiBase { //Die if token required, but not provided (unless there is a gettoken parameter) $salt = $module->getTokenSalt(); - if ( $salt != false ) + if ( $salt !== false ) { if ( !isset( $moduleParams['token'] ) && !isset( $moduleParams['gettoken'] ) ) { $this->dieUsageMsg( array( 'missingparam', 'token' ) ); } else { global $wgUser; - if ( ( $salt != null && !$wgUser->matchEditToken( $moduleParams['token'], $salt ) ) - || !$wgUser->matchEditToken( $moduleParams['token'] ) ) { + if ( !$wgUser->matchEditToken( $moduleParams['token'], $salt ) ) { $this->dieUsageMsg( array( 'sessionfailure' ) ); } } diff --git a/includes/api/ApiMove.php b/includes/api/ApiMove.php index 66bf71bdda..fca1e5d7d9 100644 --- a/includes/api/ApiMove.php +++ b/includes/api/ApiMove.php @@ -220,7 +220,7 @@ class ApiMove extends ApiBase { } public function getTokenSalt() { - return null; + return ''; } protected function getExamples() { diff --git a/includes/api/ApiPatrol.php b/includes/api/ApiPatrol.php index f42523be08..63ce0ce4af 100644 --- a/includes/api/ApiPatrol.php +++ b/includes/api/ApiPatrol.php @@ -93,7 +93,7 @@ class ApiPatrol extends ApiBase { } public function getTokenSalt() { - return null; + return ''; } protected function getExamples() { diff --git a/includes/api/ApiRollback.php b/includes/api/ApiRollback.php index d09800c7ba..af252dcdcf 100644 --- a/includes/api/ApiRollback.php +++ b/includes/api/ApiRollback.php @@ -123,7 +123,7 @@ class ApiRollback extends ApiBase { } public function getTokenSalt() { - return null; + return ''; } protected function getExamples() { diff --git a/includes/api/ApiUnblock.php b/includes/api/ApiUnblock.php index 9fe7ac9867..4b631e2223 100644 --- a/includes/api/ApiUnblock.php +++ b/includes/api/ApiUnblock.php @@ -117,7 +117,7 @@ class ApiUnblock extends ApiBase { } public function getTokenSalt() { - return null; + return ''; } protected function getExamples() { diff --git a/includes/api/ApiUndelete.php b/includes/api/ApiUndelete.php index 41ee00dadd..4dc603f8af 100644 --- a/includes/api/ApiUndelete.php +++ b/includes/api/ApiUndelete.php @@ -126,7 +126,7 @@ class ApiUndelete extends ApiBase { } public function getTokenSalt() { - return null; + return ''; } protected function getExamples() { diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 0995326df2..ed0df7e2fb 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -343,7 +343,7 @@ class ApiUpload extends ApiBase { } public function getTokenSalt() { - return null; + return ''; } protected function getExamples() { -- 2.20.1