Skip to content

Commit e99ad8b

Browse files
chalasrnicolas-grekas
authored andcommitted
[Security] Fix access_control behavior with unanimous decision strategy
1 parent 8bbf709 commit e99ad8b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Authorization/AccessDecisionManager.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,16 @@ public function __construct(iterable $voters = [], string $strategy = self::STRA
5353
}
5454

5555
/**
56+
* @param bool $allowMultipleAttributes Whether to allow passing multiple values to the $attributes array
57+
*
5658
* {@inheritdoc}
5759
*/
58-
public function decide(TokenInterface $token, array $attributes, $object = null)
60+
public function decide(TokenInterface $token, array $attributes, $object = null/*, bool $allowMultipleAttributes = false*/)
5961
{
60-
if (\count($attributes) > 1) {
62+
$allowMultipleAttributes = 3 < func_num_args() && func_get_arg(3);
63+
64+
// Special case for AccessListener, do not remove the right side of the condition before 6.0
65+
if (\count($attributes) > 1 && !$allowMultipleAttributes) {
6166
@trigger_error(sprintf('Passing more than one Security attribute to "%s()" is deprecated since Symfony 4.4. Use multiple "decide()" calls or the expression language (e.g. "is_granted(...) or is_granted(...)") instead.', __METHOD__), E_USER_DEPRECATED);
6267
}
6368

0 commit comments

Comments
 (0)