From 67fb284497fe5ef3e96487a1a67eeac95bb494f1 Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 18 Jun 2019 13:23:18 +0700 Subject: [PATCH] Fix bug with AccessVoter --- Security/Authorization/Voter/AccessVoter.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Security/Authorization/Voter/AccessVoter.php b/Security/Authorization/Voter/AccessVoter.php index 359ded8..8ce478b 100644 --- a/Security/Authorization/Voter/AccessVoter.php +++ b/Security/Authorization/Voter/AccessVoter.php @@ -101,6 +101,10 @@ public function supportsClass($class) */ public function vote(TokenInterface $token, $object, array $attributes) { + if (!is_object($object)) { + return VoterInterface::ACCESS_ABSTAIN; + } + $class = get_class($object); if (!$this->supportsClass($class)) { @@ -174,4 +178,4 @@ private function isExistsObjectByConditions($object, array $conditions, $alias) return $isValid; } -} \ No newline at end of file +}