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

Fixed some issues of the AccessDecisionManager profiler #18934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
Prev Previous commit
Next Next commit
Improved the code
  • Loading branch information
javiereguiluz committed Jun 29, 2016
commit 639c8ead203e988ff6125954ab397c4f6989d397
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ public function __construct(AccessDecisionManagerInterface $manager)
{
$this->manager = $manager;

// The strategy is stored in a private property of the decorated service
$reflection = new \ReflectionProperty($manager, 'strategy');
$reflection->setAccessible(true);
$this->strategy = $reflection->getValue($manager);
if ($this->manager instanceof AccessDecisionManager) {
// The strategy is stored in a private property of the decorated service
$reflection = new \ReflectionProperty(AccessDecisionManager::class, 'strategy');
$reflection->setAccessible(true);
$this->strategy = $reflection->getValue($manager);
}
}

/**
Expand All @@ -60,6 +62,10 @@ public function decide(TokenInterface $token, array $attributes, $object = null)
*/
public function setVoters(array $voters)
{
if (!$this->manager instanceof AccessDecisionManager) {
return;
}

$this->voters = $voters;
$this->manager->setVoters($voters);
}
Expand All @@ -72,7 +78,7 @@ public function getStrategy()
// The $strategy property is misleading because it stores the name of its
// method (e.g. 'decideAffirmative') instead of the original strategy name
// (e.g. 'affirmative')
return strtolower(substr($this->strategy, 6));
return null === $this->strategy ? '-' : strtolower(substr($this->strategy, 6));
}

/**
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.