diff --git a/src/Symfony/Component/Security/CHANGELOG.md b/src/Symfony/Component/Security/CHANGELOG.md index 566625a7c1f7c..e7c5db97f4740 100644 --- a/src/Symfony/Component/Security/CHANGELOG.md +++ b/src/Symfony/Component/Security/CHANGELOG.md @@ -1,5 +1,9 @@ CHANGELOG ========= +5.3.0 +----- + + * Deprecation error in `AccessDecisionManager`. Cast when voter return value different than integer. 5.2.0 ----- diff --git a/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php b/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php index 8356c38bb93fc..e701a1cb391bb 100644 --- a/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php +++ b/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php @@ -82,6 +82,9 @@ private function decideAffirmative(TokenInterface $token, array $attributes, $ob $deny = 0; foreach ($this->voters as $voter) { $result = $voter->vote($token, $object, $attributes); + if (false === \is_int($result)) { + trigger_deprecation('symfony/security-core', '5.3', 'Returning a value of type "%s" in "%s::vote()" is deprecated, return an int instead.', get_debug_type($result), get_debug_type($voter)); + } if (VoterInterface::ACCESS_GRANTED === $result) { return true; @@ -119,6 +122,9 @@ private function decideConsensus(TokenInterface $token, array $attributes, $obje $deny = 0; foreach ($this->voters as $voter) { $result = $voter->vote($token, $object, $attributes); + if (false === \is_int($result)) { + trigger_deprecation('symfony/security-core', '5.3', 'Returning a value of type "%s" in "%s::vote()" is deprecated, return an int instead.', get_debug_type($result), get_debug_type($voter)); + } if (VoterInterface::ACCESS_GRANTED === $result) { ++$grant; @@ -154,6 +160,9 @@ private function decideUnanimous(TokenInterface $token, array $attributes, $obje foreach ($this->voters as $voter) { foreach ($attributes as $attribute) { $result = $voter->vote($token, $object, [$attribute]); + if (false === \is_int($result)) { + trigger_deprecation('symfony/security-core', '5.3', 'Returning a value of type "%s" in "%s::vote()" is deprecated, return an int instead.', get_debug_type($result), get_debug_type($voter)); + } if (VoterInterface::ACCESS_DENIED === $result) { return false; @@ -184,6 +193,9 @@ private function decidePriority(TokenInterface $token, array $attributes, $objec { foreach ($this->voters as $voter) { $result = $voter->vote($token, $object, $attributes); + if (false === \is_int($result)) { + trigger_deprecation('symfony/security-core', '5.3', 'Returning a value of type "%s" in "%s::vote()" is deprecated, return an int instead.', get_debug_type($result), get_debug_type($voter)); + } if (VoterInterface::ACCESS_GRANTED === $result) { return true;
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: