From: Niklas Laxström Date: Wed, 3 Apr 2013 12:17:32 +0000 (+0000) Subject: User::addGroup could cause duplicate groups X-Git-Tag: 1.31.0-rc.0~19902 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/categories/modifier.php?a=commitdiff_plain;h=a956fd06c332e1d8bb59fbfcf3dcca13b97a385a;p=lhc%2Fweb%2Fwiklou.git User::addGroup could cause duplicate groups Use array_unique to avoid this case. Bug: 46844 Change-Id: I14eb6e5a5333d887d71d545e42570493437dd320 --- 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();