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

Commit 52847d3

Browse files
Merge branch '3.1'
* 3.1: [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 [FrameworkBundle] Fix Incorrect line break in exception message (500 debug page) [Security] Added note inside phpdoc. Minor cleanups and improvements [form] lazy trans `post_max_size_message`. [DI] Fix setting synthetic services on ContainerBuilder [ClassLoader] Fix ClassCollectionLoader inlining with declare(strict_types=1)
2 parents 6685a4f + 63cc48e commit 52847d3

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Core/Authorization/Voter/Voter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ abstract protected function supports($attribute, $subject);
5858

5959
/**
6060
* Perform a single access check operation on a given attribute, subject and token.
61+
* It is safe to assume that $attribute and $subject already passed the "supports()" method check.
6162
*
6263
* @param string $attribute
6364
* @param mixed $subject

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)