Make sure that id taken from cookie is an int; otherwise it goes to 0
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 19 Feb 2004 06:40:52 +0000 (06:40 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 19 Feb 2004 06:40:52 +0000 (06:40 +0000)
includes/User.php

index b3e5d98..7a21052 100644 (file)
@@ -163,7 +163,7 @@ class User {
                                return new User();
                        }
                } else if ( isset( $HTTP_COOKIE_VARS["{$wgDBname}UserID"] ) ) {
-                       $sId = $HTTP_COOKIE_VARS["{$wgDBname}UserID"];
+                       $sId = IntVal( $HTTP_COOKIE_VARS["{$wgDBname}UserID"] );
                        $wsUserID = $sId;
                } else {
                        return new User();
@@ -214,6 +214,10 @@ class User {
        function loadFromDatabase()
        {
                if ( $this->mDataLoaded ) { return; }
+               
+               # Paranoia
+               $this->mId = IntVal( $this->mId );
+
                # check in separate table if there are changes to the talk page
                $this->mNewtalk=0; # reset talk page status
                if($this->mId) {