Skip to content

Commit fad374e

Browse files
committed
bug #19667 [SecurityBundle] Add missing deprecation notice for form_login.intention (ro0NL)
This PR was squashed before being merged into the 2.8 branch (closes #19667). Discussion ---------- [SecurityBundle] Add missing deprecation notice for form_login.intention | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #19664, #19661, #19652 | License | MIT | Doc PR | - By the grace of @chalasr ping @fabpot Commits ------- 2a7bbd1 [SecurityBundle] Add missing deprecation notice for form_login.intention
2 parents b90139a + 2a7bbd1 commit fad374e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/FormLoginFactory.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ public function addConfiguration(NodeDefinition $node)
5252
->ifTrue(function ($v) { return isset($v['csrf_provider']) && isset($v['csrf_token_generator']); })
5353
->thenInvalid("You should define a value for only one of 'csrf_provider' and 'csrf_token_generator' on a security firewall. Use 'csrf_token_generator' as this replaces 'csrf_provider'.")
5454
->end()
55+
->beforeNormalization()
56+
->ifTrue(function ($v) { return isset($v['intention']) && isset($v['csrf_token_id']); })
57+
->thenInvalid("You should define a value for only one of 'intention' and 'csrf_token_id' on a security firewall. Use 'csrf_token_id' as this replaces 'intention'.")
58+
->end()
5559
->beforeNormalization()
5660
->ifTrue(function ($v) { return isset($v['csrf_provider']); })
5761
->then(function ($v) {
@@ -62,7 +66,18 @@ public function addConfiguration(NodeDefinition $node)
6266

6367
return $v;
6468
})
65-
->end()
69+
->end()
70+
->beforeNormalization()
71+
->ifTrue(function ($v) { return isset($v['intention']); })
72+
->then(function ($v) {
73+
@trigger_error("Setting the 'intention' configuration key on a security firewall is deprecated since version 2.8 and will be removed in 3.0. Use the 'csrf_token_id' key instead.", E_USER_DEPRECATED);
74+
75+
$v['csrf_token_id'] = $v['intention'];
76+
unset($v['intention']);
77+
78+
return $v;
79+
})
80+
->end()
6681
->children()
6782
->scalarNode('csrf_token_generator')->cannotBeEmpty()->end()
6883
->end()

0 commit comments

Comments
 (0)