-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection][Filesystem][Security][SecurityBundle] remove deprecated features #24364
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
Conversation
xabbuh
commented
Sep 28, 2017
Q | A |
---|---|
Branch? | master |
Bug fix? | no |
New feature? | no |
BC breaks? | yes |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | |
License | MIT |
Doc PR |
@@ -76,7 +76,7 @@ public function __construct(TokenStorageInterface $tokenStorage, iterable $userP | |||
*/ | |||
public function setLogoutOnUserChange($logoutOnUserChange) | |||
{ | |||
$this->logoutOnUserChange = (bool) $logoutOnUserChange; | |||
// no-op, to be deprecated in 4.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it throw if false is provided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, in the deprecation message of the related option we tell the user that it will be ignored in 4.0. So, I think we can do the same with the method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On v3.0, in ChoiceType, we threw an exception when "$choices_as_values !== true" in a similar case. Is there any difference here?
64c1890
to
aa33204
Compare
aa33204
to
6802cbf
Compare
@@ -270,8 +258,6 @@ private function getAutowiredReference(TypedReference $reference, $deprecationMe | |||
if (isset($this->autowired[$type])) { | |||
return $this->autowired[$type] ? new TypedReference($this->autowired[$type], $type) : null; | |||
} | |||
|
|||
return $this->createAutowiredDefinition($type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dunglas @nicolas-grekas @GuilhemN Can you confirm that this is the proper fix here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
{ | ||
@trigger_error('Calling InlineServiceDefinitionsPass::getInlinedServiceIds() is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); | ||
|
||
return $this->inlinedServiceIds; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't the property be removed as well? otherwise I don't see the point of it
6802cbf
to
cf00efa
Compare
$this->logoutOnUserChange = (bool) $logoutOnUserChange; | ||
// to be deprecated in 4.1 | ||
if (true !== $logoutOnUserChange) { | ||
throw new \RuntimeException(sprintf('The %s() should not be used with a value other than true.', __METHOD__)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same should be done in the bundle configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, I am not sure anymore if we should really throw the exception here. I mean this is now a code path that changes its behaviour compared to Symfony 3.4 without triggering a deprecation before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory this would shield it when people set it to false and didn't adhere to the deprecation from 3.4. In theory nothing breaks though, except that a useless method call is executed.
Could instead make it trigger just a deprecation in 4.1
$this->logoutOnUserChange = (bool) $logoutOnUserChange; | ||
// to be deprecated in 4.1 | ||
if (true !== $logoutOnUserChange) { | ||
throw new \RuntimeException(sprintf('The %s() should not be used with a value other than true.', __METHOD__)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing method
after %s()
rebase needed (the DI part has been removed in another PR) |
a4cc3d6
to
85a7ef4
Compare
rebased and changelog files updated too, failures are not related |
Are you sure failures are not related? It looks like this may break 3.4, isn't it? |
I see two solutions: Either we don't throw the exception in |
@symfony/deciders Any preferences how we resolve #24364 (comment)? Basically, this is caused by the change I made based on the discussion in #24364 (comment). The difference compared to the example in the Form component mentioned by @nicolas-grekas is that we did not have any cross-component usage of the |
My preference goes for the no-op in 4.0, deprecating the method in 4.1. |
@@ -14,6 +14,8 @@ CHANGELOG | |||
* removed command `init:acl` along with `InitAclCommand` class | |||
* removed `acl` configuration key and related services, use symfony/acl-bundle instead | |||
* removed auto picking the first registered provider when no configured provider on a firewall and ambiguous | |||
* The firewall option `logout_on_user_change` is now always true, which will trigger a logout if the user changes | |||
between requests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a note for the switch_user.stateless
option. I was about to use:
* made the `switch_user.stateless` option `true` when firewall is stateless
* @group legacy | ||
* @expectedDeprecation Firewall "some_firewall" is configured as "stateless" but the "switch_user.stateless" key is set to false. Both should have the same value, the firewall's "stateless" value will be used as default value for the "switch_user.stateless" key in 4.0. | ||
*/ | ||
public function testSwitchUserNotStatelessOnStatelessFirewall() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to rename this test, remove the legacy flag and add the following assertion
$this->assertTrue($container->getDefinition('security.authentication.switchuser_listener.default')->getArgument(9));
5cdd00c
to
75f9c3f
Compare
@chalasr done |
@@ -202,7 +202,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto | |||
->booleanNode('stateless')->defaultFalse()->end() | |||
->scalarNode('context')->cannotBeEmpty()->end() | |||
->booleanNode('logout_on_user_change') | |||
->defaultFalse() | |||
->defaultTrue() | |||
->info('When true, it will trigger a logout for the user if something has changed. This will be the default behavior as of Syfmony 4.0.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last sentence should be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
75f9c3f
to
45dd40c
Compare
Thank you @xabbuh. |
…ndle] remove deprecated features (xabbuh) This PR was merged into the 4.0-dev branch. Discussion ---------- [DependencyInjection][Filesystem][Security][SecurityBundle] remove deprecated features | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- 45dd40c remove deprecated features
…deprecated (chalasr) This PR was merged into the 4.1 branch. Discussion ---------- [Security] The logout_on_user_change firewall option is deprecated Since symfony/symfony#24364 Commits ------- 18c8f91 [Security] The logout_on_user_change firewall option is deprecated