jenkins-bot has submitted this change and it was merged.

Change subject: User::addGroup could cause duplicate groups
......................................................................


User::addGroup could cause duplicate groups

Use array_unique to avoid this case.

Bug: 46844
Change-Id: I14eb6e5a5333d887d71d545e42570493437dd320
---
M includes/User.php
1 file changed, 3 insertions(+), 0 deletions(-)

Approvals:
  IAlex: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/User.php b/includes/User.php
index cb5ad7a..dd6407d 100644
--- a/includes/User.php
+++ b/includes/User.php
@@ -2668,6 +2668,9 @@
                }
                $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();

-- 
To view, visit https://gerrit.wikimedia.org/r/57284
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I14eb6e5a5333d887d71d545e42570493437dd320
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
Gerrit-Reviewer: IAlex <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to