Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Commit 3c4059b

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: [travis/appveyor] Wire simple-phpunit [Console] fixed PHP7 Errors are now handled and converted to Exceptions Fix #19721 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
2 parents 8aa4ba6 + bd17076 commit 3c4059b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Core/Role/RoleHierarchy.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,17 @@ protected function buildRoleMap()
6565
}
6666

6767
$visited[] = $role;
68-
$this->map[$main] = array_unique(array_merge($this->map[$main], $this->hierarchy[$role]));
69-
$additionalRoles = array_merge($additionalRoles, array_diff($this->hierarchy[$role], $visited));
68+
69+
foreach ($this->hierarchy[$role] as $roleToAdd) {
70+
$this->map[$main][] = $roleToAdd;
71+
}
72+
73+
foreach (array_diff($this->hierarchy[$role], $visited) as $additionalRole) {
74+
$additionalRoles[] = $additionalRole;
75+
}
7076
}
77+
78+
$this->map[$main] = array_unique($this->map[$main]);
7179
}
7280
}
7381
}

0 commit comments

Comments
 (0)