8000 Merge branch '5.1' · symfony/symfony-docs@78148c8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 78148c8

Browse files
10000 committed
Merge branch '5.1'
* 5.1: (21 commits) Adding `path` Fixing bad path for class PdoSessionHandler Fix package name modified post merge Fix typos: DNS -> DSN Fix term Fix inconsistent security docs Fix debug:container command Fix logout on form login setup Change char to varchar type Remove reference to non-existing fromBinary method Use redirectToRoute [#13980] add annotation config example [Validator] Made the code sample more explicit with accepted values Update voters.rst Update voters.rst Update voters.rst Update security/voters.rst Update voters.rst [#13554] Slightly reworded the tip Update voters.rst ...
2 parents aeca8d7 + 24dd511 commit 78148c8

16 files changed

+93
-71
lines changed

components/http_foundation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ or change its ``Content-Disposition``::
647647
'filename.txt'
648648
);
649649

650-
It is possible to delete the file after the request is sent with the
650+
It is possible to delete the file after the response is sent with the
651651
:method:`Symfony\\Component\\HttpFoundation\\BinaryFileResponse::deleteFileAfterSend` method.
652652
Please note that this will not work when the ``X-Sendfile`` header is set.
653653

components/phpunit_bridge.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ the compiling and warming up of the container:
336336

337337
.. code-block:: terminal
338338
339-
$ debug:container --deprecations
339+
$ php bin/console debug:container --deprecations
340340
341341
.. versionadded:: 5.1
342342

components/uid.rst

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,10 @@ to create each type of UUID::
6262
If your UUID is generated by another system, use the ``fromString()`` method to
6363
create an object and make use of the utilities available for Symfony UUIDs::
6464

65-
// this value is generated somewhere else
65+
// this value is generated somewhere else (can also be in binary format)
6666
$uuidValue = 'd9e7a184-5d5b-11ea-a62a-3499710062d0';
6767
$uuid = Uuid::fromString($uuidValue);
6868

69-
If your UUIDs are generated in binary format, use the ``fromBinary()`` method
70-
to create the objects for them::
71-
72-
$uuid = Uuid::fromBinary($uuidBinaryContents);
73-
7469
Converting UUIDs
7570
~~~~~~~~~~~~~~~~
7671

@@ -140,15 +135,10 @@ Instantiate the ``Ulid`` class to generate a random ULID value::
140135
If your ULID is generated by another system, use the ``fromString()`` method to
141136
create an object and make use of the utilities available for Symfony ULIDs::
142137

143-
// this value is generated somewhere else
138+
// this value is generated somewhere else (can also be in binary format)
144139
$ulidValue = '01E439TP9XJZ9RPFH3T1PYBCR8';
145140
$ulid = Ulid::fromString($ulidValue);
146141

147-
If your ULIDs are generated in binary format, use 741A the ``fromBinary()`` method
148-
to create the objects for them::
149-
150-
$ulid = Ulid::fromBinary($ulidBinaryContents);
151-
152142
Converting ULIDs
153143
~~~~~~~~~~~~~~~~
154144

controller/upload_file.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ Finally, you need to update the code of the controller that handles the form::
171171

172172
// ... persist the $product variable or any other work
173173

174-
return $this->redirect($this->generateUrl('app_product_list'));
174+
return $this->redirectToRoute('app_product_list');
175175
}
176176

177177
return $this->render('product/new.html.twig', [

mailer.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Transport Setup
1919
---------------
2020

2121
Emails are delivered via a "transport". Out of the box, you can deliver emails
22-
over SMTP by configuring the DNS in your ``.env`` file (the ``user``,
22+
over SMTP by configuring the DSN in your ``.env`` file (the ``user``,
2323
``pass`` and ``port`` parameters are optional):
2424

2525
.. code-block:: env
@@ -83,7 +83,7 @@ transport, but you can force to use one:
8383
# force to use SMTP instead of HTTP (which is the default)
8484
MAILER_DSN=sendgrid+smtp://$SENDGRID_KEY@default
8585
86-
This table shows the full list of available DNS formats for each third
86+
This table shows the full list of available DSN formats for each third
8787
party provider:
8888

8989
==================== ========================================== =========================================== ========================================

notifier.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ to send SMS messages to mobile phones. This feature requires subscribing to
5454
a third-party service that sends SMS messages. Symfony provides integration
5555
with a couple popular SMS services:
5656

57-
========== =============================== ====================================================
57+
========== ================================ ====================================================
5858
Service Package DSN
59-
========== =============================== ====================================================
60-
Twilio ``symfony/twilio-notifier`` ``twilio://SID:TOKEN@default?from=FROM``
61-
Nexmo ``symfony/nexmo-notifier`` ``nexmo://KEY:SECRET@default?from=FROM``
62-
OvhCloud ``symfony/ovhcloud-notifier`` ``ovhcloud://APPLICATION_KEY:APPLICATION_SECRET@default?consumer_key=CONSUMER_KEY&service_name=SERVICE_NAME``
63-
Sinch ``symfony/sinch-notifier`` ``sinch://ACCOUNT_ID:AUTH_TOKEN@default?from=FROM``
64-
FreeMobile ``symfony/freemobile-notifier`` ``freemobile://LOGIN:PASS@default?phone=PHONE``
65-
Smsapi ``symfony/smsapi-notifier`` ``smsapi://TOKEN@default?from=FROM``
66-
========== =============================== ====================================================
59+
========== ================================ ====================================================
60+
Twilio ``symfony/twilio-notifier`` ``twilio://SID:TOKEN@default?from=FROM``
61+
Nexmo ``symfony/nexmo-notifier`` ``nexmo://KEY:SECRET@default?from=FROM``
62+
OvhCloud ``symfony/ovhcloud-notifier`` ``ovhcloud://APPLICATION_KEY:APPLICATION_SECRET@default?consumer_key=CONSUMER_KEY&service_name=SERVICE_NAME``
63+
Sinch ``symfony/sinch-notifier`` ``sinch://ACCOUNT_ID:AUTH_TOKEN@default?from=FROM``
64+
FreeMobile ``symfony/free-mobile-notifier`` ``freemobile://LOGIN:PASSWORD@default?phone=PHONE``
65+
Smsapi ``symfony/smsapi-notifier`` ``smsapi://TOKEN@default?from=FROM``
66+
========== ================================ ====================================================
6767

6868
.. versionadded:: 5.1
6969

reference/configuration/security.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,14 @@ the current firewall and not the other ones.
540540

541541
.. _reference-security-logout-success-handler:
542542

543+
``path``
544+
~~~~~~~~
545+
546+
**type**: ``string`` **default**: ``/logout``
547+
548+
The path which triggers logout. If you change it from the default value ``/logout``,
549+
you need to set up a route with a matching path.
550+
543551
success_handler
544552
~~~~~~~~~~~~~~~
545553

reference/constraints/Collection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ you can do the following:
209209
* }
210210
* )
211211
*/
212-
protected $profileData = ['personal_email'];
212+
protected $profileData = ['personal_email' => 'email@example.com'];
213213
}
214214
215215
.. code-block:: yaml

security/form_login.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ First, enable ``form_login`` under your firewall:
2828
2929
firewalls:
3030
main:
31-
anonymous: lazy
31+
anonymous: true
32+
lazy: true
3233
form_login:
3334
login_path: login
3435
check_path: login
@@ -46,8 +47,7 @@ First, enable ``form_login`` under your firewall:
4647
https://symfony.com/schema/dic/security/security-1.0.xsd">
4748
4849
<config>
49-
<firewall name="main">
50-
<anonymous lazy="true"/>
50+
<firewall name="main" anonymous="true" lazy="true">
5151
<form-login login-path="login" check-path="login"/>
5252
</firewall>
5353
</config>
@@ -59,7 +59,8 @@ First, enable ``form_login`` under your firewall:
5959
$container->loadFromExtension('security', [
6060
'firewalls' => [
6161
'main' => [
62-
'anonymous' => 'lazy',
62+
'anonymous' => true,
63+
'lazy' => true,
6364
'form_login' => [
6465
'login_path' => 'login',
6566
'check_path' => 'login',

security/form_login_setup.rst

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,13 @@ Edit the ``security.yaml`` file in order to declare the ``/logout`` path:
9999
security:
100100
# ...
101101
102-
providers:
103-
# ...
104-
logout:
105-
path: app_logout
106-
# where to redirect after logout
107-
# target: app_any_route
102+
firewalls:
103+
main:
104+
# ...
105+
logout:
106+
path: app_logout
107+
# where to redirect after logout
108+
# target: app_any_route
108109
109110
.. code-block:: xml
110111
@@ -119,8 +120,11 @@ Edit the ``security.yaml`` file in order to declare the ``/logout`` path:
119120
https://symfony.com/schema/dic/security/security-1.0.xsd">
120121
121122
<config>
122-
<rule path="^/login$" role="IS_AUTHENTICATED_ANONYMOUSLY"/>
123123
<!-- ... -->
124+
<firewall name="main">
125+
<!-- ... -->
126+
<logout path="app_logout"/>
127+
</firewall>
124128
</config>
125129
</srv:container>
126130
@@ -129,12 +133,15 @@ Edit the ``security.yaml`` file in order to declare the ``/logout`` path:
129133
// config/packages/security.php
130134
$container->loadFromExtension('security', [
131135
// ...
132-
'access_control' => [
133-
[
134-
'path' => '^/login',
135-
'roles' => 'IS_AUTHENTICATED_ANONYMOUSLY',
136+
'firewalls' => [
137+
'main' => [
138+
// ...
139+
'logout' => [
140+
'path' => 'app_logout',
141+
// where to redirect after logout
142+
'target' => 'app_any_route'
143+
],
136144
],
137-
// ...
138145
],
139146
]);
140147

security/guard_authentication.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ Finally, configure your ``firewalls`` key in ``security.yaml`` to use this authe
189189
# ...
190190
191191
main:
192-
anonymous: lazy
192+
anonymous: true
193+
lazy: true
193194
logout: ~
194195
195196
guard:
@@ -217,8 +218,7 @@ Finally, configure your ``firewalls`` key in ``security.yaml`` to use this authe
217218
218219
<!-- if you want, disable storing the user in the session
219220
add 'stateless="true"' to the firewall -->
220-
<firewall name="main" pattern="^/">
221-
<anonymous lazy="true"/>
221+
<firewall name="main" pattern="^/" anonymous="true" lazy="true">
222222
<logout/>
223223
224224
<guard>
@@ -241,7 +241,8 @@ Finally, configure your ``firewalls`` key in ``security.yaml`` to use this authe
241241
'firewalls' => [
242242
'main' => [
243243
'pattern' => '^/',
244-
'anonymous' => 'lazy',
244+
'anonymous' => true,
245+
'lazy' => true,
245246
'logout' => true,
246247
'guard' => [
247248
'authenticators' => [

security/json_login_setup.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ First, enable the JSON login under your firewall:
1717
1818
firewalls:
1919
main:
20-
anonymous: lazy
20+
anonymous: true
21+
lazy: true
2122
json_login:
2223
check_path: /login
2324
@@ -34,8 +35,7 @@ First, enable the JSON login under your firewall:
3435
https://symfony.com/schema/dic/security/security-1.0.xsd">
3536
3637
<config>
37-
<firewall name="main">
38-
<anonymous lazy="true"/>
38+
<firewall name="main" anonymous="true" lazy="true">
3939
<json-login check-path="/login"/>
4040
</firewall>
4141
</config>
@@ -47,7 +47,8 @@ First, enable the JSON login under your firewall:
4747
$container->loadFromExtension('security', [
4848
'firewalls' => [
4949
'main' => [
50-
'anonymous' => 'lazy',
50+
'anonymous' => true,
51+
'lazy' => true,
5152
'json_login' => [
5253
'check_path' => '/login',
5354
],
@@ -165,7 +166,8 @@ The security configuration should be:
165166
166167
firewalls:
167168
main:
168-
anonymous: lazy
169+
anonymous: true
170+
lazy: true
169171
json_login:
170172
check_path: login
171173
username_path: security.credentials.login
@@ -184,8 +186,7 @@ The security configuration should be:
184186
https://symfony.com/schema/dic/security/security-1.0.xsd">
185187
186188
<config>
187-
<firewall name="main">
188-
<anonymous lazy="true"/>
189+
<firewall name="main" anonymous="true" lazy="true">
189190
<json-login check-path="login"
190191
username-path="security.credentials.login"
191192
password-path="security.credentials.password"/>
@@ -199,7 +200,8 @@ The security configuration should be:
199200
$container->loadFromExtension('security', [
200201
'firewalls' => [
201202
'main' => [
202-
'anonymous' => 'lazy',
203+
'anonymous' => true,
204+
'lazy' => true,
203205
'json_login' => [
204206
'check_path' => 'login',
205207
'username_path' => 'security.credentials.login',

security/multiple_guard_authenticators.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ This is how your security configuration can look in action:
2727
# ...
2828
firewalls:
2929
default:
30-
anonymous: lazy
30+
anonymous: true
31+
lazy: true
3132
guard:
3233
authenticators:
3334
- App\Security\LoginFormAuthenticator
@@ -48,8 +49,7 @@ This is how your security configuration can look in action:
4849
4950
<config>
5051
<!-- ... -->
51-
<firewall name="default">
52-
<anonymous lazy="true"/>
52+
<firewall name="default" anonymous="true" lazy="true">
5353
<guard entry-point="App\Security\LoginFormAuthenticator">
5454
<authenticator>App\Security\LoginFormAuthenticator</authenticator>
5555
<authenticator>App\Security\FacebookConnectAuthenticator</authenticator>
@@ -68,7 +68,8 @@ This is how your security configuration can look in action:
6868
// ...
6969
'firewalls' => [
7070
'default' => [
71-
'anonymous' => 'lazy',
71+
'anonymous' => true,
72+
'lazy' => true,
7273
'guard' => [
7374
'entry_point' => LoginFormAuthenticator::class,
7475
'authenticators' => [
@@ -105,7 +106,8 @@ the solution is to split the configuration into two separate firewalls:
105106
authenticators:
106107
- App\Security\ApiTokenAuthenticator
107108
default:
108-
anonymous: lazy
109+
anonymous: true
110+
lazy: true
109111
guard:
110112
authenticators:
111113
- App\Security\LoginFormAuthenticator
@@ -133,8 +135,7 @@ the solution is to split the configuration into two separate firewalls:
133135
<authenticator>App\Security\ApiTokenAuthenticator</authenticator>
134136
</guard>
135137
</firewall>
136-
<firewall name="default">
137-
<anonymous lazy="true"/>
138+
<firewall name="default" anonymous="true" lazy="true">
138139
<guard>
139140
<authenticator>App\Security\LoginFormAuthenticator</authenticator>
140141
</guard>
@@ -163,7 +164,8 @@ the solution is to split the configuration into two separate firewalls:
163164
],
164165
],
165166
'default' => [
166-
'anonymous' => 'lazy',
167+
'anonymous' => true,
168+
'lazy' => true,
167169
'guard' => [
168170
'authenticators' => [
169171
LoginFormAuthenticator::class,

security/remember_me.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ so ``DoctrineTokenProvider`` can store the tokens:
261261
262262
CREATE TABLE `rememberme_token` (
263263
`series` char(88) UNIQUE PRIMARY KEY NOT NULL,
264-
`value` char(88) NOT NULL,
264+
`value` varchar(88) NOT NULL,
265265
`lastUsed` datetime NOT NULL,
266266
`class` varchar(100) NOT NULL,
267267
`username` varchar(200) NOT NULL

0 commit comments

Comments
 (0)
0