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

Commit 63cc48e

Browse files
committed
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
2 parents d75aac7 + 3c4059b commit 63cc48e

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)