summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2016-06-30 11:40:30 +0200
committerFabien Potencier <fabien.potencier@gmail.com>2016-06-30 11:40:30 +0200
commit02478ada26786d5d7260c3db873ab401e64c57f7 (patch)
treef8942adc10a4396b4a91ecc9b83690ec25f40817
parent6c4c152f2a7a0b22d49074a71e34fc4020eeac22 (diff)
parentee959deafc05bb80f579827bfea736082949911b (diff)
downloadsymfony-security-02478ada26786d5d7260c3db873ab401e64c57f7.zip
symfony-security-02478ada26786d5d7260c3db873ab401e64c57f7.tar.gz
symfony-security-02478ada26786d5d7260c3db873ab401e64c57f7.tar.bz2
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
-rw-r--r--Core/Authorization/DebugAccessDecisionManager.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/Core/Authorization/DebugAccessDecisionManager.php b/Core/Authorization/DebugAccessDecisionManager.php
index 540d998..1a04bc1 100644
--- a/Core/Authorization/DebugAccessDecisionManager.php
+++ b/Core/Authorization/DebugAccessDecisionManager.php
@@ -26,17 +26,19 @@ class DebugAccessDecisionManager implements AccessDecisionManagerInterface
{
private $manager;
private $strategy;
- private $voters;
+ private $voters = array();
private $decisionLog = array();
- public function __construct(AccessDecisionManager $manager)
+ 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);
+ }
}
/**
@@ -60,6 +62,10 @@ class DebugAccessDecisionManager implements AccessDecisionManagerInterface
*/
public function setVoters(array $voters)
{
+ if (!$this->manager instanceof AccessDecisionManager) {
+ return;
+ }
+
$this->voters = $voters;
$this->manager->setVoters($voters);
}
@@ -72,7 +78,7 @@ class DebugAccessDecisionManager implements AccessDecisionManagerInterface
// 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));
}
/**