User::isAnon() via User::isLoggedIn() has unexpected behavior from an optimization...
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 27 Dec 2007 05:10:03 +0000 (05:10 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 27 Dec 2007 05:10:03 +0000 (05:10 +0000)
includes/SpecialUserrights.php
includes/User.php

index a2d78c7..c5ab965 100644 (file)
@@ -208,7 +208,7 @@ class UserrightsForm extends HTMLForm {
                        $user = UserRightsProxy::newFromName( $database, $name );
                }
                
-               if( !$user || $user->isAnon() ) {
+               if( !$user || $user->getId() == 0 ) {
                        $wgOut->addWikiText( wfMsg( 'nosuchusershort', wfEscapeWikiText( $username ) ) );
                        return null;
                }
index e7bbda9..c22ed5f 100644 (file)
@@ -1729,6 +1729,7 @@ class User {
         * Returns true if the user is not an anonymous visitor.
         *
         * @return bool
+        * @fixme "special-case optimization" may fail for an object referring to a user that doesn't exist in the system.
         */
        function isLoggedIn() {
                if( $this->mId === null and $this->mName !== null ) {