summaryrefslogtreecommitdiffstats
path: root/Core
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2016-09-12 11:17:37 -0700
committerFabien Potencier <fabien.potencier@gmail.com>2016-09-12 11:17:37 -0700
commit63cc48ef437cbd3994ef14f55796f709147c1326 (patch)
tree6dd029c35b0c2b5d4ffa8fd069d2e1feb58b8934 /Core
parentd75aac76395cec69bdb87711a96fa91e8be14f3d (diff)
parent3c4059b0b58d3c54adee85da6594c46478de958c (diff)
downloadsymfony-security-63cc48ef437cbd3994ef14f55796f709147c1326.zip
symfony-security-63cc48ef437cbd3994ef14f55796f709147c1326.tar.gz
symfony-security-63cc48ef437cbd3994ef14f55796f709147c1326.tar.bz2
Merge branch '2.8' into 3.1
* 2.8: [travis/appveyor] Wire simple-phpunit [Console] fixed PHP7 Errors are now handled and converted to Exceptions Fix #19721 Fix translation:update command count bumped Symfony version to 2.8.12 updated VERSION for 2.8.11 updated CHANGELOG for 2.8.11 bumped Symfony version to 2.7.19 updated VERSION for 2.7.18 update CONTRIBUTORS for 2.7.18 updated CHANGELOG for 2.7.18 [Security] Optimize RoleHierarchy's buildRoleMap method
Diffstat (limited to 'Core')
-rw-r--r--Core/Role/RoleHierarchy.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/Core/Role/RoleHierarchy.php b/Core/Role/RoleHierarchy.php
index 793007e..95e76ee 100644
--- a/Core/Role/RoleHierarchy.php
+++ b/Core/Role/RoleHierarchy.php
@@ -65,9 +65,17 @@ class RoleHierarchy implements RoleHierarchyInterface
}
$visited[] = $role;
- $this->map[$main] = array_unique(array_merge($this->map[$main], $this->hierarchy[$role]));
- $additionalRoles = array_merge($additionalRoles, array_diff($this->hierarchy[$role], $visited));
+
+ foreach ($this->hierarchy[$role] as $roleToAdd) {
+ $this->map[$main][] = $roleToAdd;
+ }
+
+ foreach (array_diff($this->hierarchy[$role], $visited) as $additionalRole) {
+ $additionalRoles[] = $additionalRole;
+ }
}
+
+ $this->map[$main] = array_unique($this->map[$main]);
}
}
}