User::addGroup could cause duplicate groups
[lhc/web/wiklou.git] / includes / User.php
index cb5ad7a..dd6407d 100644 (file)
@@ -2668,6 +2668,9 @@ class User {
                }
                $this->loadGroups();
                $this->mGroups[] = $group;
+               // In case loadGroups was not called before, we now have the right twice.
+               // Get rid of the duplicate.
+               $this->mGroups = array_unique( $this->mGroups );
                $this->mRights = User::getGroupPermissions( $this->getEffectiveGroups( true ) );
 
                $this->invalidateCache();