Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1b86fc0

Browse filesBrowse files
HaehnchenDaniel Espendiller
authored and
Daniel Espendiller
committed
AbstractVoter should abstain string objects
1 parent 0bd8b58 commit 1b86fc0
Copy full SHA for 1b86fc0

File tree

2 files changed

+2
-1
lines changed
Filter options

2 files changed

+2
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authorization/Voter/AbstractVoter.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function supportsClass($class)
5858
*/
5959
public function vote(TokenInterface $token, $object, array $attributes)
6060
{
61-
if (!$object || !$this->supportsClass(get_class($object))) {
61+
if (!$object || !is_object($object) || !$this->supportsClass(get_class($object))) {
6262
return self::ACCESS_ABSTAIN;
6363
}
6464

‎src/Symfony/Component/Security/Core/Tests/Authorization/Voter/AbstractVoterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Tests/Authorization/Voter/AbstractVoterTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public function getTests()
3939
array(array('EDIT'), VoterInterface::ACCESS_ABSTAIN, $this, 'ACCESS_ABSTAIN if class is not supported'),
4040

4141
array(array('EDIT'), VoterInterface::ACCESS_ABSTAIN, null, 'ACCESS_ABSTAIN if object is null'),
42+
array(array('EDIT'), VoterInterface::ACCESS_ABSTAIN, 'foo', 'ACCESS_ABSTAIN if object is string'),
4243

4344
array(array(), VoterInterface::ACCESS_ABSTAIN, new \stdClass(), 'ACCESS_ABSTAIN if no attributes were provided'),
4445
);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.