Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 73ce604

Browse files
Fix the 'supports' method argument type of the security voter
1 parent 0109515 commit 73ce604

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/Symfony/Component/Security/Core/Authorization/Voter/Voter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function vote(TokenInterface $token, $subject, array $attributes)
3030
$vote = self::ACCESS_ABSTAIN;
3131

3232
foreach ($attributes as $attribute) {
33-
if (!$this->supports($attribute, $subject)) {
33+
if (!\is_string($attribute) || !$this->supports($attribute, $subject)) {
3434
continue;
3535
}
3636

src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public function getTests()
4343
[['EDIT'], VoterInterface::ACCESS_ABSTAIN, null, 'ACCESS_ABSTAIN if object is null'],
4444

4545
[[], VoterInterface::ACCESS_ABSTAIN, new \stdClass(), 'ACCESS_ABSTAIN if no attributes were provided'],
46+
47+
[[new \stdClass()], VoterInterface::ACCESS_ABSTAIN, new \stdClass(), 'ACCESS_ABSTAIN if attributes were not strings'],
4648
];
4749
}
4850

0 commit comments

Comments
 (0)