Skip to content

Commit cae89ca

Browse files
author
Daniel Espendiller
committed
AbstractVoter should abstain string objects
1 parent 0bd8b58 commit cae89ca

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

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

Lines 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

Lines 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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy