r70814 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70813‎ | r70814 | r70815 >
Date:13:30, 10 August 2010
Author:demon
Status:ok
Tags:
Comment:
Cleanup r70571, more strict checks for getCookie() return values
Modified paths:
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/includes/extauth/vB.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -827,7 +827,7 @@
828828 $this->mOptionOverrides = null;
829829 $this->mOptionsLoaded = false;
830830
831 - if( $wgRequest->getCookie( 'LoggedOut' ) ) {
 831+ if( $wgRequest->getCookie( 'LoggedOut' ) !== null ) {
832832 $this->mTouched = wfTimestamp( TS_MW, $wgRequest->getCookie( 'LoggedOut' ) );
833833 } else {
834834 $this->mTouched = '0'; # Allow any pages to be cached
@@ -875,7 +875,7 @@
876876 }
877877 }
878878
879 - if ( $wgRequest->getCookie( 'UserID' ) ) {
 879+ if ( $wgRequest->getCookie( 'UserID' ) !== null ) {
880880 $sId = intval( $wgRequest->getCookie( 'UserID' ) );
881881 if( isset( $_SESSION['wsUserID'] ) && $sId != $_SESSION['wsUserID'] ) {
882882 $this->loadDefaults(); // Possible collision!
@@ -898,7 +898,7 @@
899899
900900 if ( isset( $_SESSION['wsUserName'] ) ) {
901901 $sName = $_SESSION['wsUserName'];
902 - } else if ( $wgRequest->getCookie('UserName') ) {
 902+ } else if ( $wgRequest->getCookie('UserName') !== null ) {
903903 $sName = $wgRequest->getCookie('UserName');
904904 $_SESSION['wsUserName'] = $sName;
905905 } else {
@@ -923,7 +923,7 @@
924924 if ( isset( $_SESSION['wsToken'] ) ) {
925925 $passwordCorrect = $_SESSION['wsToken'] == $this->mToken;
926926 $from = 'session';
927 - } else if ( $wgRequest->getCookie( 'Token' ) ) {
 927+ } else if ( $wgRequest->getCookie( 'Token' ) !== null ) {
928928 $passwordCorrect = $this->mToken == $wgRequest->getCookie( 'Token' );
929929 $from = 'cookie';
930930 } else {
Index: trunk/phase3/includes/extauth/vB.php
@@ -61,7 +61,7 @@
6262 } else {
6363 $prefix = $wgExternalAuthConf['cookieprefix'];
6464 }
65 - if ( !$wgRequest->getCookie( 'sessionhash', $prefix ) ) {
 65+ if ( $wgRequest->getCookie( 'sessionhash', $prefix ) === null ) {
6666 return false;
6767 }
6868

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r70571Cleanup getCookie() and use it all over the place instead of using $_COOKIE d...demon15:00, 6 August 2010

Status & tagging log