diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/collectors.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/collectors.xml
index 738455358b..de157d5182 100644
--- a/src/Symfony/Bundle/SecurityBundle/Resources/config/collectors.xml
+++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/collectors.xml
@@ -10,7 +10,7 @@
-
+
diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_debug.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_debug.xml
index 4312d74741..eb22cbddf5 100644
--- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_debug.xml
+++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_debug.xml
@@ -1,8 +1,8 @@
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json
index 6e22dc9192..a67980b643 100644
--- a/src/Symfony/Bundle/SecurityBundle/composer.json
+++ b/src/Symfony/Bundle/SecurityBundle/composer.json
@@ -17,7 +17,7 @@
],
"require": {
"php": ">=5.5.9",
- "symfony/security": "~3.1",
+ "symfony/security": "~3.1,>=3.1.2",
"symfony/http-kernel": "~2.8|~3.0",
"symfony/polyfill-php70": "~1.0"
},
diff --git a/src/Symfony/Component/Security/Core/Authorization/DebugAccessDecisionManager.php b/src/Symfony/Component/Security/Core/Authorization/DebugAccessDecisionManager.php
index 540d998206..1a04bc1f60 100644
--- a/src/Symfony/Component/Security/Core/Authorization/DebugAccessDecisionManager.php
+++ b/src/Symfony/Component/Security/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));
}
/**