Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit da202fe

Browse filesBrowse files
committed
[SecurityBundle][Security][Finder] Remove deprecated code paths
- [Finder] Removed `ExceptionInterface` - [SecurityBundle] remove `UserPasswordEncoderCommand` BC layer - [Security] remove `LogoutUrlGenerator::registerListener` BC layer
1 parent 7047b41 commit da202fe
Copy full SHA for da202fe

File tree

Expand file treeCollapse file tree

7 files changed

+17
-87
lines changed
Filter options
Expand file treeCollapse file tree

7 files changed

+17
-87
lines changed

‎src/Symfony/Bundle/SecurityBundle/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ CHANGELOG
66

77
* removed `FirewallContext::getContext()`
88
* made `FirewallMap::$container` and `::$map` private
9+
* made the first `UserPasswordEncoderCommand::_construct()` argument mandatory
10+
* `UserPasswordEncoderCommand` does not extend `ContainerAwareCommand` anymore
911

1012
3.3.0
1113
-----

‎src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php
+4-26Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,51 +11,35 @@
1111

1212
namespace Symfony\Bundle\SecurityBundle\Command;
1313

14-
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
14+
use Symfony\Component\Console\Command\Command;
1515
use Symfony\Component\Console\Input\InputArgument;
1616
use Symfony\Component\Console\Input\InputInterface;
1717
use Symfony\Component\Console\Input\InputOption;
1818
use Symfony\Component\Console\Output\ConsoleOutputInterface;
1919
use Symfony\Component\Console\Output\OutputInterface;
2020
use Symfony\Component\Console\Question\Question;
2121
use Symfony\Component\Console\Style\SymfonyStyle;
22-
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
2322
use Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder;
2423
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
25-
use Symfony\Component\Security\Core\User\User;
2624

2725
/**
2826
* Encode a user's password.
2927
*
3028
* @author Sarah Khalil <mkhalil.sarah@gmail.com>
3129
*/
32-
class UserPasswordEncoderCommand extends ContainerAwareCommand
30+
class UserPasswordEncoderCommand extends Command
3331
{
3432
private $encoderFactory;
3533
private $userClasses;
3634

37-
public function __construct(EncoderFactoryInterface $encoderFactory = null, array $userClasses = array())
35+
public function __construct(EncoderFactoryInterface $encoderFactory, array $userClasses = array())
3836
{
39-
if (null === $encoderFactory) {
40-
@trigger_error(sprintf('Passing null as the first argument of "%s" is deprecated since version 3.3 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED);
41-
}
42-
4337
$this->encoderFactory = $encoderFactory;
4438
$this->userClasses = $userClasses;
4539

4640
parent::__construct();
4741
}
4842

49-
/**
50-
* {@inheritdoc}
51-
*/
52-
protected function getContainer()
53-
{
54-
@trigger_error(sprintf('Method "%s" is deprecated since version 3.3 and "%s" won\'t implement "%s" anymore in 4.0.', __METHOD__, __CLASS__, ContainerAwareInterface::class), E_USER_DEPRECATED);
55-
56-
return parent::getContainer();
57-
}
58-
5943
/**
6044
* {@inheritdoc}
6145
*/
@@ -123,8 +107,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
123107
$userClass = $this->getUserClass($input, $io);
124108
$emptySalt = $input->getOption('empty-salt');
125109

126-
$encoderFactory = $this->encoderFactory ?: parent::getContainer()->get('security.encoder_factory');
127-
$encoder = $encoderFactory->getEncoder($userClass);
110+
$encoder = $this->encoderFactory->getEncoder($userClass);
128111
$bcryptWithoutEmptySalt = !$emptySalt && $encoder instanceof BCryptPasswordEncoder;
129112

130113
if ($bcryptWithoutEmptySalt) {
@@ -206,11 +189,6 @@ private function getUserClass(InputInterface $input, SymfonyStyle $io)
206189
}
207190

208191
if (empty($this->userClasses)) {
209-
if (null === $this->encoderFactory) {
210-
// BC to be removed and simply keep the exception whenever there is no configured user classes in 4.0
211-
return User::class;
212-
}
213-
214192
throw new \RuntimeException('There are no configured encoders for the "security" extension.');
215193
}
216194

‎src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
-22Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -193,28 +193,6 @@ public function testThrowsExceptionOnNoConfiguredEncoders()
193193
), array('interactive' => false));
194194
}
195195

196-
/**
197-
* @group legacy
198-
* @expectedDeprecation Passing null as the first argument of "Symfony\Bundle\SecurityBundle\Command\UserPasswordEncoderCommand::__construct" is deprecated since version 3.3 and will be removed in 4.0. If the command was registered by convention, make it a service instead.
199-
*/
200-
public function testLegacy()
201-
{
202-
$application = new ConsoleApplication();
203-
$application->add(new UserPasswordEncoderCommand());
204-
205-
$passwordEncoderCommand = $application->find('security:encode-password');
206-
self::bootKernel(array('test_case' => 'PasswordEncode'));
207-
$passwordEncoderCommand->setContainer(self::$kernel->getContainer());
208-
209-
$tester = new CommandTester($passwordEncoderCommand);
210-
$tester->execute(array(
211-
'command' => 'security:encode-password',
212-
'password' => 'password',
213-
), array('interactive' => false));
214-
215-
$this->assertContains('Encoder used Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder', $tester->getDisplay());
216-
}
217-
218196
protected function setUp()
219197
{
220198
putenv('COLUMNS='.(119 + strlen(PHP_EOL)));

‎src/Symfony/Component/Finder/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Finder/CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
4.0.0
5+
-----
6+
7+
* removed `ExceptionInterface`
8+
49
3.3.0
510
-----
611

‎src/Symfony/Component/Finder/Exception/ExceptionInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Finder/Exception/ExceptionInterface.php
-25Lines changed: 0 additions & 25 deletions
This file was deleted.

‎src/Symfony/Component/Security/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
4.0.0
5+
-----
6+
7+
* added a sixth `string $context` argument to`LogoutUrlGenerator::registerListener()`
8+
49
3.3.0
510
-----
611

‎src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php
+1-14Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,8 @@ public function __construct(RequestStack $requestStack = null, UrlGeneratorInter
4848
* @param CsrfTokenManagerInterface|null $csrfTokenManager A CsrfTokenManagerInterface instance
4949
* @param string|null $context The listener context
5050
*/
51-
public function registerListener($key, $logoutPath, $csrfTokenId, $csrfParameter, CsrfTokenManagerInterface $csrfTokenManager = null/*, string $context = null*/)
51+
public function registerListener($key, $logoutPath, $csrfTokenId, $csrfParameter, CsrfTokenManagerInterface $csrfTokenManager = null, string $context = null)
5252
{
53-
if (func_num_args() >= 6) {
54-
$context = func_get_arg(5);
55-
} else {
56-
if (__CLASS__ !== get_class($this)) {
57-
$r = new \ReflectionMethod($this, __FUNCTION__);
58-
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
59-
@trigger_error(sprintf('Method %s() will have a sixth `string $context = null` argument in version 4.0. Not defining it is deprecated since 3.3.', __METHOD__), E_USER_DEPRECATED);
60-
}
61-
}
62-
63-
$context = null;
64-
}
65-
6653
$this->listeners[$key] = array($logoutPath, $csrfTokenId, $csrfParameter, $csrfTokenManager, $context);
6754
}
6855

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.