Skip to content

[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

Merged
merged 1 commit into from
Oct 6, 2017

Conversation

xabbuh
Copy link
Member

@xabbuh 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
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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?

@xabbuh xabbuh force-pushed the remove-deprecated-features branch 2 times, most recently from 64c1890 to aa33204 Compare September 28, 2017 19:29
@xabbuh xabbuh force-pushed the remove-deprecated-features branch from aa33204 to 6802cbf Compare September 28, 2017 19:52
@@ -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);
Copy link
Member Author

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?

Copy link
Member

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;
Copy link
Contributor

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

@xabbuh xabbuh force-pushed the remove-deprecated-features branch from 6802cbf to cf00efa Compare September 29, 2017 08:34
$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__));
Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Contributor

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__));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing method after %s()

@nicolas-grekas
Copy link
Member

rebase needed (the DI part has been removed in another PR)

@xabbuh xabbuh force-pushed the remove-deprecated-features branch 5 times, most recently from a4cc3d6 to 85a7ef4 Compare October 3, 2017 20:32
@xabbuh
Copy link
Member Author

xabbuh commented Oct 3, 2017

rebased and changelog files updated too, failures are not related

@nicolas-grekas
Copy link
Member

Are you sure failures are not related? It looks like this may break 3.4, isn't it?

@xabbuh
Copy link
Member Author

xabbuh commented Oct 3, 2017

I see two solutions: Either we don't throw the exception in ContextListener::setLogoutOnUserChange() and silently ignore any value being passed (probably deprecating any value that is not true in 4.1) or we need to update the SecurityExtension in 3.4 to not add the method call when the bundle is used with the Security component in version 4.0.

@xabbuh
Copy link
Member Author

xabbuh commented Oct 5, 2017

@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 choices_as_values option with a value other than true in Symfony 2.8.

@chalasr
Copy link
Member

chalasr commented Oct 5, 2017

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.
Copy link
Member

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()
Copy link
Member

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));

@xabbuh xabbuh force-pushed the remove-deprecated-features branch 2 times, most recently from 5cdd00c to 75f9c3f Compare October 6, 2017 09:50
@xabbuh
Copy link
Member Author

xabbuh commented Oct 6, 2017

@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.')
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@xabbuh xabbuh force-pushed the remove-deprecated-features branch from 75f9c3f to 45dd40c Compare October 6, 2017 12:47
@fabpot
Copy link
Member

fabpot commented Oct 6, 2017

Thank you @xabbuh.

@fabpot fabpot merged commit 45dd40c into symfony:master Oct 6, 2017
fabpot added a commit that referenced this pull request Oct 6, 2017
…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
@xabbuh xabbuh deleted the remove-deprecated-features branch October 6, 2017 14:46
@fabpot fabpot mentioned this pull request Oct 19, 2017
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Oct 29, 2018
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants