Skip to content

Navigation Menu

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 16f20b2

Browse filesBrowse files
Merge branch '5.4' into 6.0
* 5.4: [Form] fix support for years outside of the 32b range on x86 arch CS fix remove duplicate test Add an upgrade note about the removal of Serializable [SecurityBundle] Don't register deprecated listeners with authenticator manager enabled
2 parents 0b81b38 + e574a24 commit 16f20b2
Copy full SHA for 16f20b2

File tree

11 files changed

+158
-153
lines changed
Filter options

11 files changed

+158
-153
lines changed

‎UPGRADE-6.0.md

Copy file name to clipboardExpand all lines: UPGRADE-6.0.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ Routing
199199
Security
200200
--------
201201

202+
* Authentication tokens do not implement the deprecated `Serializable`
203+
interface anymore. The consequence is that tokens that were serialized (e.g.
204+
into the session) with PHP 7.3 or below cannot be unserialized anymore. It is
205+
recommended to roll out a Symfony 5 application with PHP 7.4 or later first
206+
before upgrading it to Symfony 6.
202207
* Remove class `User`, use `InMemoryUser` or your own implementation instead.
203208
If you are using the `isAccountNonLocked()`, `isAccountNonExpired()` or `isCredentialsNonExpired()` method, consider re-implementing them
204209
in your own user class as they are not part of the `InMemoryUser` API

‎src/Symfony/Bundle/SecurityBundle/Resources/config/security_legacy.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Resources/config/security_legacy.php
+121Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@
1313

1414
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
1515
use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager;
16+
use Symfony\Component\Security\Core\Authentication\Provider\AnonymousAuthenticationProvider;
17+
use Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider;
18+
use Symfony\Component\Security\Core\Authentication\Provider\LdapBindAuthenticationProvider;
19+
use Symfony\Component\Security\Core\Authentication\Provider\PreAuthenticatedAuthenticationProvider;
20+
use Symfony\Component\Security\Http\Firewall\AnonymousAuthenticationListener;
21+
use Symfony\Component\Security\Http\Firewall\BasicAuthenticationListener;
22+
use Symfony\Component\Security\Http\Firewall\RemoteUserAuthenticationListener;
23+
use Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener;
24+
use Symfony\Component\Security\Http\Firewall\UsernamePasswordJsonAuthenticationListener;
25+
use Symfony\Component\Security\Http\Firewall\X509AuthenticationListener;
1626

1727
return static function (ContainerConfigurator $container) {
1828
$container->services()
@@ -24,6 +34,117 @@
2434
param('security.authentication.manager.erase_credentials'),
2535
])
2636
->call('setEventDispatcher', [service('event_dispatcher')])
37+
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
2738
->alias(AuthenticationManagerInterface::class, 'security.authentication.manager')
39+
->deprecate('symfony/security-bundle', '5.3', 'The "%alias_id%" alias is deprecated, use the new authenticator system instead.')
40+
41+
->set('security.authentication.listener.anonymous', AnonymousAuthenticationListener::class)
42+
->args([
43+
service('security.untracked_token_storage'),
44+
abstract_arg('Key'),
45+
service('logger')->nullOnInvalid(),
46+
service('security.authentication.manager'),
47+
])
48+
->tag('monolog.logger', ['channel' => 'security'])
49+
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
50+
51+
->set('security.authentication.provider.anonymous', AnonymousAuthenticationProvider::class)
52+
->args([abstract_arg('Key')])
53+
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
54+
55+
->set('security.authentication.listener.form', UsernamePasswordFormAuthenticationListener::class)
56+
->parent('security.authentication.listener.abstract')
57+
->abstract()
58+
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
59+
60+
->set('security.authentication.listener.x509', X509AuthenticationListener::class)
61+
->abstract()
62+
->args([
63+
service('security.token_storage'),
64+
service('security.authentication.manager'),
65+
abstract_arg('Provider-shared Key'),
66+
abstract_arg('x509 user'),
67+
abstract_arg('x509 credentials'),
68+
service('logger')->nullOnInvalid(),
69+
service('event_dispatcher')->nullOnInvalid(),
70+
])
71+
->tag('monolog.logger', ['channel' => 'security'])
72+
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
73+
74+
->set('security.authentication.listener.json', UsernamePasswordJsonAuthenticationListener::class)
75+
->abstract()
76+
->args([
77+
service('security.token_storage'),
78+
service('security.authentication.manager'),
79+
service('security.http_utils'),
80+
abstract_arg('Provider-shared Key'),
81+
abstract_arg('Failure handler'),
82+
abstract_arg('Success Handler'),
83+
[], // Options
84+
service('logger')->nullOnInvalid(),
85+
service('event_dispatcher')->nullOnInvalid(),
86+
service('property_accessor')->nullOnInvalid(),
87+
])
88+
->call('setTranslator', [service('translator')->ignoreOnInvalid()])
89+
->tag('monolog.logger', ['channel' => 'security'])
90+
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
91+
92+
->set('security.authentication.listener.remote_user', RemoteUserAuthenticationListener::class)
93+
->abstract()
94+
->args([
95+
service('security.token_storage'),
96+
service('security.authentication.manager'),
97+
abstract_arg('Provider-shared Key'),
98+
abstract_arg('REMOTE_USER server env var'),
99+
service('logger')->nullOnInvalid(),
100+
service('event_dispatcher')->nullOnInvalid(),
101+
])
102+
->tag('monolog.logger', ['channel' => 'security'])
103+
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
104+
105+
->set('security.authentication.listener.basic', BasicAuthenticationListener::class)
106+
->abstract()
107+
->args([
108+
service('security.token_storage'),
109+
service('security.authentication.manager'),
110+
abstract_arg('Provider-shared Key'),
111+
abstract_arg('Entry Point'),
112+
service('logger')->nullOnInvalid(),
113+
])
114+
->tag('monolog.logger', ['channel' => 'security'])
115+
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
116+
117+
->set('security.authentication.provider.dao', DaoAuthenticationProvider::class)
118+
->abstract()
119+
->args([
120+
abstract_arg('User Provider'),
121+
abstract_arg('User Checker'),
122+
abstract_arg('Provider-shared Key'),
123+
service('security.password_hasher_factory'),
124+
param('security.authentication.hide_user_not_found'),
125+
])
126+
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
127+
128+
->set('security.authentication.provider.ldap_bind', LdapBindAuthenticationProvider::class)
129+
->abstract()
130+
->args([
131+
abstract_arg('User Provider'),
132+
abstract_arg('UserChecker'),
133+
abstract_arg('Provider-shared Key'),
134+
abstract_arg('LDAP'),
135+
abstract_arg('Base DN'),
136+
param('security.authentication.hide_user_not_found'),
137+
abstract_arg('search dn'),
138+
abstract_arg('search password'),
139+
])
140+
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
141+
142+
->set('security.authentication.provider.pre_authenticated', PreAuthenticatedAuthenticationProvider::class)
143+
->abstract()
144+
->args([
145+
abstract_arg('User Provider'),
146+
abstract_arg('UserChecker'),
147+
])
148+
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
28149
;
29150
};

‎src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.php
-118Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111

1212
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
1313

14-
use Symfony\Component\Security\Core\Authentication\Provider\AnonymousAuthenticationProvider;
15-
use Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider;
16-
use Symfony\Component\Security\Core\Authentication\Provider\LdapBindAuthenticationProvider;
17-
use Symfony\Component\Security\Core\Authentication\Provider\PreAuthenticatedAuthenticationProvider;
1814
use Symfony\Component\Security\Http\AccessMap;
1915
use Symfony\Component\Security\Http\Authentication\CustomAuthenticationFailureHandler;
2016
use Symfony\Component\Security\Http\Authentication\CustomAuthenticationSuccessHandler;
@@ -27,33 +23,14 @@
2723
use Symfony\Component\Security\Http\EventListener\DefaultLogoutListener;
2824
use Symfony\Component\Security\Http\EventListener\SessionLogoutListener;
2925
use Symfony\Component\Security\Http\Firewall\AccessListener;
30-
use Symfony\Component\Security\Http\Firewall\AnonymousAuthenticationListener;
31-
use Symfony\Component\Security\Http\Firewall\BasicAuthenticationListener;
3226
use Symfony\Component\Security\Http\Firewall\ChannelListener;
3327
use Symfony\Component\Security\Http\Firewall\ContextListener;
3428
use Symfony\Component\Security\Http\Firewall\ExceptionListener;
3529
use Symfony\Component\Security\Http\Firewall\LogoutListener;
36-
use Symfony\Component\Security\Http\Firewall\RemoteUserAuthenticationListener;
3730
use Symfony\Component\Security\Http\Firewall\SwitchUserListener;
38-
use Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener;
39-
use Symfony\Component\Security\Http\Firewall\UsernamePasswordJsonAuthenticationListener;
40-
use Symfony\Component\Security\Http\Firewall\X509AuthenticationListener;
4131

4232
return static function (ContainerConfigurator $container) {
4333
$container->services()
44-
->set('security.authentication.listener.anonymous', AnonymousAuthenticationListener::class)
45-
->args([
46-
service('security.untracked_token_storage'),
47-
abstract_arg('Key'),
48-
service('logger')->nullOnInvalid(),
49-
service('security.authentication.manager'),
50-
])
51-
->tag('monolog.logger', ['channel' => 'security'])
52-
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
53-
54-
->set('security.authentication.provider.anonymous', AnonymousAuthenticationProvider::class)
55-
->args([abstract_arg('Key')])
56-
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
5734

5835
->set('security.authentication.retry_entry_point', RetryAuthenticationEntryPoint::class)
5936
->args([
@@ -160,101 +137,6 @@
160137
])
161138
->tag('monolog.logger', ['channel' => 'security'])
162139

163-
->set('security.authentication.listener.form', UsernamePasswordFormAuthenticationListener::class)
164-
->parent('security.authentication.listener.abstract')
165-
->abstract()
166-
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
167-
168-
->set('security.authentication.listener.x509', X509AuthenticationListener::class)
169-
->abstract()
170-
->args([
171-
service('security.token_storage'),
172-
service('security.authentication.manager'),
173-
abstract_arg('Provider-shared Key'),
174-
abstract_arg('x509 user'),
175-
abstract_arg('x509 credentials'),
176-
service('logger')->nullOnInvalid(),
177-
service('event_dispatcher')->nullOnInvalid(),
178-
])
179-
->tag('monolog.logger', ['channel' => 'security'])
180-
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
181-
182-
->set('security.authentication.listener.json', UsernamePasswordJsonAuthenticationListener::class)
183-
->abstract()
184-
->args([
185-
service('security.token_storage'),
186-
service('security.authentication.manager'),
187-
service('security.http_utils'),
188-
abstract_arg('Provider-shared Key'),
189-
abstract_arg('Failure handler'),
190-
abstract_arg('Success Handler'),
191-
[], // Options
192-
service('logger')->nullOnInvalid(),
193-
service('event_dispatcher')->nullOnInvalid(),
194-
service('property_accessor')->nullOnInvalid(),
195-
])
196-
->call('setTranslator', [service('translator')->ignoreOnInvalid()])
197-
->tag('monolog.logger', ['channel' => 'security'])
198-
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
199-
200-
->set('security.authentication.listener.remote_user', RemoteUserAuthenticationListener::class)
201-
->abstract()
202-
->args([
203-
service('security.token_storage'),
204-
service('security.authentication.manager'),
205-
abstract_arg('Provider-shared Key'),
206-
abstract_arg('REMOTE_USER server env var'),
207-
service('logger')->nullOnInvalid(),
208-
service('event_dispatcher')->nullOnInvalid(),
209-
])
210-
->tag('monolog.logger', ['channel' => 'security'])
211-
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
212-
213-
->set('security.authentication.listener.basic', BasicAuthenticationListener::class)
214-
->abstract()
215-
->args([
216-
service('security.token_storage'),
217-
service('security.authentication.manager'),
218-
abstract_arg('Provider-shared Key'),
219-
abstract_arg('Entry Point'),
220-
service('logger')->nullOnInvalid(),
221-
])
222-
->tag('monolog.logger', ['channel' => 'security'])
223-
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
224-
225-
->set('security.authentication.provider.dao', DaoAuthenticationProvider::class)
226-
->abstract()
227-
->args([
228-
abstract_arg('User Provider'),
229-
abstract_arg('User Checker'),
230-
abstract_arg('Provider-shared Key'),
231-
service('security.password_hasher_factory'),
232-
param('security.authentication.hide_user_not_found'),
233-
])
234-
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
235-
236-
->set('security.authentication.provider.ldap_bind', LdapBindAuthenticationProvider::class)
237-
->abstract()
238-
->args([
239-
abstract_arg('User Provider'),
240-
abstract_arg('UserChecker'),
241-
abstract_arg('Provider-shared Key'),
242-
abstract_arg('LDAP'),
243-
abstract_arg('Base DN'),
244-
param('security.authentication.hide_user_not_found'),
245-
abstract_arg('search dn'),
246-
abstract_arg('search password'),
247-
])
248-
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
249-
250-
->set('security.authentication.provider.pre_authenticated', PreAuthenticatedAuthenticationProvider::class)
251-
->abstract()
252-
->args([
253-
abstract_arg('User Provider'),
254-
abstract_arg('UserChecker'),
255-
])
256-
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
257-
258140
->set('security.exception_listener', ExceptionListener::class)
259141
->abstract()
260142
->args([

‎src/Symfony/Component/Form/Extension/Core/Type/DateType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/DateType.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,7 @@ private function listYears(array $years)
375375
$result = [];
376376

377377
foreach ($years as $year) {
378-
if (false !== $y = gmmktime(0, 0, 0, 6, 15, $year)) {
379-
$result[$y] = $year;
380-
}
378+
$result[\PHP_INT_SIZE === 4 ? \DateTime::createFromFormat('Y e', $year.' UTC')->format('U') : gmmktime(0, 0, 0, 6, 15, $year)] = $year;
381379
}
382380

383381
return $result;

‎src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
+3-7Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -927,19 +927,15 @@ public function testDayErrorsBubbleUp($widget)
927927
$this->assertSame([$error], iterator_to_array($form->getErrors()));
928928
}
929929

930-
public function testYearsFor32BitsMachines()
930+
public function testYears()
931931
{
932-
if (4 !== \PHP_INT_SIZE) {
933-
$this->markTestSkipped('PHP 32 bit is required.');
934-
}
935-
936932
$view = $this->factory->create(static::TESTED_TYPE, null, [
937-
'years' => range(1900, 2040),
933+
'years' => [1900, 2000, 2040],
938934
])
939935
->createView();
940936

941937
$listChoices = [];
942-
foreach (range(1902, 2037) as $y) {
938+
foreach ([1900, 2000, 2040] as $y) {
943939
$listChoices[] = new ChoiceView($y, $y, $y);
944940
}
945941

‎src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public static function create(?string $locale, ?int $datetype, ?int $timetype, $
182182
/**
183183
* Format the date/time value (timestamp) as a string.
184184
*
185-
* @param int|\DateTimeInterface $timestamp The timestamp to format
185+
* @param int|string|\DateTimeInterface $timestamp The timestamp to format
186186
*
187187
* @return string|bool The formatted value or false if formatting failed
188188
*
@@ -194,11 +194,15 @@ public function format($timestamp)
194194
{
195195
// intl allows timestamps to be passed as arrays - we don't
196196
if (\is_array($timestamp)) {
197-
$message = 'Only integer Unix timestamps and DateTime objects are supported';
197+
$message = 'Only Unix timestamps and DateTime objects are supported';
198198

199199
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'timestamp', $timestamp, $message);
200200
}
201201

202+
if (\is_string($timestamp) && $dt = \DateTime::createFromFormat('U', $timestamp)) {
203+
$timestamp = $dt;
204+
}
205+
202206
// behave like the intl extension
203207
$argumentError = null;
204208
if (!\is_int($timestamp) && !$timestamp instanceof \DateTimeInterface) {
@@ -214,7 +218,7 @@ public function format($timestamp)
214218
}
215219

216220
if ($timestamp instanceof \DateTimeInterface) {
217-
$timestamp = $timestamp->getTimestamp();
221+
$timestamp = $timestamp->format('U');
218222
}
219223

220224
$transformer = new FullTransformer($this->getPattern(), $this->getTimeZoneId());
@@ -585,8 +589,7 @@ public function setTimeZone($timeZone)
585589
*/
586590
protected function createDateTime(int $timestamp)
587591
{
588-
$dateTime = new \DateTime();
589-
$dateTime->setTimestamp($timestamp);
592+
$dateTime = \DateTime::createFromFormat('U', $timestamp);
590593
$dateTime->setTimezone($this->dateTimeZone);
591594

592595
return $dateTime;

‎src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function testFormatWithUnsupportedTimestampArgument()
7575
} catch (\Exception $e) {
7676
$this->assertInstanceOf(MethodArgumentValueNotImplementedException::class, $e);
7777

78-
$this->assertStringEndsWith('Only integer Unix timestamps and DateTime objects are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage());
78+
$this->assertStringEndsWith('Only Unix timestamps and DateTime objects are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage());
7979
}
8080
}
8181

0 commit comments

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