Don't force loading of groups and options on User::loadFromUserObject
authordaniel <daniel.kinzler@wikimedia.de>
Sat, 6 Aug 2016 16:44:08 +0000 (18:44 +0200)
committerAaron Schulz <aschulz@wikimedia.org>
Sat, 6 Aug 2016 23:40:39 +0000 (23:40 +0000)
When copying state from one User object to another, don't force
the source object to be initialized. The target object can initialize
groups and options on demand as usual.

Among other things, this helps to avoid some cases of recursive calls
to User::load(), see I6d1b9fe0789b4.

Bug: T142295
Bug: T137051
Change-Id: Ib369cf5b00628550591c2ee5dcb195db7c59a59c

includes/user/User.php

index 8d3fcea..181ff46 100644 (file)
@@ -1387,8 +1387,6 @@ class User implements IDBAccessObject {
         */
        protected function loadFromUserObject( $user ) {
                $user->load();
-               $user->loadGroups();
-               $user->loadOptions();
                foreach ( self::$mCacheVars as $var ) {
                        $this->$var = $user->$var;
                }