Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Commit 02478ad

Browse files
committed
Merge branch '3.1'
* 3.1: Fixed BC Layer in DoctrineChoiceLoader [HttpKernel] Add listener that checks when request has both Forwarded and X-Forwarded-For [HttpKernel] Move conflicting origin IPs handling to catch block [travis] Fix deps=low/high patching Fixed some issues of the AccessDecisionManager profiler [DoctrineBridge] fixed default parameter value in UniqueEntityValidator
2 parents 6c4c152 + ee959de commit 02478ad

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

Core/Authorization/DebugAccessDecisionManager.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,19 @@ class DebugAccessDecisionManager implements AccessDecisionManagerInterface
2626
{
2727
private $manager;
2828
private $strategy;
29-
private $voters;
29+
private $voters = array();
3030
private $decisionLog = array();
3131

32-
public function __construct(AccessDecisionManager $manager)
32+
public function __construct(AccessDecisionManagerInterface $manager)
3333
{
3434
$this->manager = $manager;
3535

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

4244
/**
@@ -60,6 +62,10 @@ public function decide(TokenInterface $token, array $attributes, $object = null)
6062
*/
6163
public function setVoters(array $voters)
6264
{
65+
if (!$this->manager instanceof AccessDecisionManager) {
66+
return;
67+
}
68+
6369
$this->voters = $voters;
6470
$this->manager->setVoters($voters);
6571
}
@@ -72,7 +78,7 @@ public function getStrategy()
7278
// The $strategy property is misleading because it stores the name of its
7379
// method (e.g. 'decideAffirmative') instead of the original strategy name
7480
// (e.g. 'affirmative')
75-
return strtolower(substr($this->strategy, 6));
81+
return null === $this->strategy ? '-' : strtolower(substr($this->strategy, 6));
7682
}
7783

7884
/**

0 commit comments

Comments
 (0)