From a956fd06c332e1d8bb59fbfcf3dcca13b97a385a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Wed, 3 Apr 2013 12:17:32 +0000 Subject: [PATCH] User::addGroup could cause duplicate groups Use array_unique to avoid this case. Bug: 46844 Change-Id: I14eb6e5a5333d887d71d545e42570493437dd320 --- includes/User.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/includes/User.php b/includes/User.php index cb5ad7a5c0..dd6407dea8 100644 --- a/includes/User.php +++ b/includes/User.php @@ -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(); -- 2.20.1