Skip to content

Commit f31a965

Browse files
committed
Merge branch '2.8' into 3.0
2 parents 14d2afb + f792232 commit f31a965

File tree

15 files changed

+122
-45
lines changed

15 files changed

+122
-45
lines changed

Diff for: book/forms.rst

+7-3
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,7 @@ The CSRF token can be customized on a form-by-form basis. For example::
18101810
'csrf_protection' => true,
18111811
'csrf_field_name' => '_token',
18121812
// a unique key to help generate the secret token
1813-
'intention' => 'task_item',
1813+
'csrf_token_id' => 'task_item',
18141814
));
18151815
}
18161816

@@ -1826,8 +1826,12 @@ section.
18261826

18271827
.. note::
18281828

1829-
The ``intention`` option is optional but greatly enhances the security of
1830-
the generated token by making it different for each form.
1829+
The ``csrf_token_id`` option is optional but greatly enhances the security
1830+
of the generated token by making it different for each form.
1831+
1832+
.. versionadded:: 2.4
1833+
The ``csrf_token_id`` option was introduced in Symfony 2.4. Prior, you
1834+
had to use the ``intention`` option.
18311835

18321836
.. caution::
18331837

Diff for: components/dependency_injection/advanced.rst

+73
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,79 @@ You can change the inner service name if you want to:
219219
->setPublic(false)
220220
->setDecoratedService('foo', 'bar.wooz');
221221
222+
.. versionadded:: 2.8
223+
The ability to define the decoration priority was introduced in Symfony 2.8.
224+
Prior to Symfony 2.8, the priority depends on the order in
225+
which definitions are found.
226+
227+
If you want to apply more than one decorator to a service, you can control their
228+
order by configuring the priority of decoration, this can be any integer number
229+
(decorators with higher priorities will be applied first).
230+
231+
.. configuration-block::
232+
233+
.. code-block:: yaml
234+
235+
foo:
236+
class: Foo
237+
238+
bar:
239+
class: Bar
240+
public: false
241+
decorates: foo
242+
decoration_priority: 5
243+
arguments: ['@bar.inner']
244+
245+
baz:
246+
class: Baz
247+
public: false
248+
decorates: foo
249+
decoration_priority: 1
250+
arguments: ['@baz.inner']
251+
252+
.. code-block:: xml
253+
254+
<?xml version="1.0" encoding="UTF-8" ?>
255+
256+
<container xmlns="http://symfony.com/schema/dic/services"
257+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
258+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
259+
260+
<services>
261+
<service id="foo" class="Foo" />
262+
263+
<service id="bar" class="Bar" decorates="foo" decoration-priority="5" public="false">
264+
<argument type="service" id="bar.inner" />
265+
</service>
266+
267+
<service id="baz" class="Baz" decorates="foo" decoration-priority="1" public="false">
268+
<argument type="service" id="baz.inner" />
269+
</service>
270+
</services>
271+
</container>
272+
273+
.. code-block:: php
274+
275+
use Symfony\Component\DependencyInjection\Reference;
276+
277+
$container->register('foo', 'Foo')
278+
279+
$container->register('bar', 'Bar')
280+
->addArgument(new Reference('bar.inner'))
281+
->setPublic(false)
282+
->setDecoratedService('foo', null, 5);
283+
284+
$container->register('baz', 'Baz')
285+
->addArgument(new Reference('baz.inner'))
286+
->setPublic(false)
287+
->setDecoratedService('foo', null, 1);
288+
289+
The generated code will be the following:
290+
291+
.. code-block:: php
292+
293+
$this->services['foo'] = new Baz(new Bar(new Foo())));
294+
222295
Deprecating Services
223296
--------------------
224297

Diff for: components/expression_language/index.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Expression Language
2-
===================
1+
ExpressionLanguage
2+
==================
33

44
.. toctree::
55
:maxdepth: 2

Diff for: components/form/introduction.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ builder:
452452

453453
.. code-block:: php-standalone
454454
455+
use Symfony\Component\Form\Extension\Core\Type\FormType;
455456
use Symfony\Component\Form\Extension\Core\Type\TextType;
456457
use Symfony\Component\Form\Extension\Core\Type\DateType;
457458
@@ -461,7 +462,7 @@ builder:
461462
'dueDate' => new \DateTime('tomorrow'),
462463
);
463464
464-
$form = $formFactory->createBuilder('form', $defaults)
465+
$form = $formFactory->createBuilder(FormType::class, $defaults)
465466
->add('task', TextType::class)
466467
->add('dueDate', DateType::class)
467468
->getForm();

Diff for: components/http_foundation/introduction.rst

+2-9
Original file line numberDiff line numberDiff line change
@@ -151,22 +151,15 @@ exist::
151151

152152
When PHP imports the request query, it handles request parameters like
153153
``foo[bar]=bar`` in a special way as it creates an array. So you can get the
154-
``foo`` parameter and you will get back an array with a ``bar`` element. But
155-
sometimes, you might want to get the value for the "original" parameter name:
156-
``foo[bar]``. This is possible with all the ``ParameterBag`` getters like
157-
:method:`Symfony\\Component\\HttpFoundation\\Request::get` via the third
158-
argument::
154+
``foo`` parameter and you will get back an array with a ``bar`` element::
159155

160156
// the query string is '?foo[bar]=bar'
161157

162158
$request->query->get('foo');
163159
// returns array('bar' => 'bar')
164160

165161
$request->query->get('foo[bar]');
166-
// returns null
167-
168-
$request->query->get('foo[bar]', null, true);
169-
// returns 'bar'
162+
// returns null
170163

171164
.. _component-foundation-attributes:
172165

Diff for: cookbook/configuration/override_dir_structure.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Override the ``cache`` Directory
3636
--------------------------------
3737

3838
You can change the default cache directory by overriding the ``getCacheDir`` method
39-
in the ``AppKernel`` class of you application::
39+
in the ``AppKernel`` class of your application::
4040

4141
// app/AppKernel.php
4242

Diff for: cookbook/controller/upload_file.rst

-5
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,6 @@ Then, add a new ``brochure`` field to the form that manages the ``Product`` enti
7676
'data_class' => 'AppBundle\Entity\Product',
7777
));
7878
}
79-
80-
public function getName()
81-
{
82-
return 'product';
83-
}
8479
}
8580

8681
Now, update the template that renders the form to display the new ``brochure``

Diff for: cookbook/form/create_form_type_extension.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ by your extension.
7373
.. tip::
7474

7575
The value you return in the ``getExtendedType`` method corresponds
76-
to the value returned by the ``getName`` method in the form type class
77-
you wish to extend.
76+
to the fully qualified class name of the form type class you wish to
77+
extend.
7878

7979
In addition to the ``getExtendedType`` function, you will probably want
8080
to override one of the following methods:

Diff for: cookbook/form/dynamic_form_modification.rst

-5
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ a bare form class looks like::
5757
'data_class' => 'AppBundle\Entity\Product'
5858
));
5959
}
60-
61-
public function getName()
62-
{
63-
return 'product';
64-
}
6560
}
6661

6762
.. note::

Diff for: cookbook/form/form_customization.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,8 @@ will be able to change the widget for each task as follows:
774774

775775
{% block _tasks_entry_widget %}
776776
<tr>
777-
<td>{{ form_widget(task.task) }}</td>
778-
<td>{{ form_widget(task.dueDate) }}</td>
777+
<td>{{ form_widget(form.task) }}</td>
778+
<td>{{ form_widget(form.dueDate) }}</td>
779779
</tr>
780780
{% endblock %}
781781

Diff for: cookbook/profiler/data_collector.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ block and set the value of two variables called ``icon`` and ``text``:
160160
{% endset %}
161161

162162
{# the 'link' value set to 'false' means that this panel doesn't
163-
show a section in the web profiler (default is 'true'). #}
163+
show a section in the web profiler #}
164164
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: false }) }}
165165
{% endblock %}
166166

@@ -203,7 +203,7 @@ must also define additional blocks:
203203
</div>
204204
{% endset %}
205205

206-
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig') }}
206+
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { 'link': true }) }}
207207
{% endblock %}
208208

209209
{% block head %}

Diff for: cookbook/security/acl_advanced.rst

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ Security Identities
4545
This is analog to the object identity, but represents a user, or a role in
4646
your application. Each role, or user has its own security identity.
4747

48+
.. caution::
49+
50+
For users, the security identity is based on the username. This means that,
51+
if for any reason, a user's username was to change, you must ensure its
52+
security identity is updated too. The
53+
:method:`MutableAclProvider::updateUserSecurityIdentity() <Symfony\\Component\\Security\\Acl\\Dbal\\MutableAclProvider::updateUserSecurityIdentity>`
54+
method is there to handle the update.
55+
4856
Database Table Structure
4957
------------------------
5058

Diff for: cookbook/security/csrf_in_login_form.rst

+15-7
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ provider available in the Security component:
3333
# ...
3434
form_login:
3535
# ...
36-
csrf_provider: security.csrf.token_manager
36+
csrf_token_generator: security.csrf.token_manager
3737
3838
.. code-block:: xml
3939
@@ -50,7 +50,7 @@ provider available in the Security component:
5050
5151
<firewall name="secured_area">
5252
<!-- ... -->
53-
<form-login csrf-provider="security.csrf.token_manager" />
53+
<form-login csrf-token-generator="security.csrf.token_manager" />
5454
</firewall>
5555
</config>
5656
</srv:container>
@@ -66,12 +66,16 @@ provider available in the Security component:
6666
// ...
6767
'form_login' => array(
6868
// ...
69-
'csrf_provider' => 'security.csrf.token_manager',
69+
'csrf_token_generator' => 'security.csrf.token_manager',
7070
),
7171
),
7272
),
7373
));
7474
75+
.. versionadded:: 2.4
76+
The ``csrf_token_generator`` option was introduced in Symfony 2.4. Prior,
77+
you had to use the ``csrf_provider`` option.
78+
7579
The Security component can be configured further, but this is all information
7680
it needs to be able to use CSRF in the login form.
7781

@@ -124,7 +128,7 @@ After this, you have protected your login form against CSRF attacks.
124128
.. tip::
125129

126130
You can change the name of the field by setting ``csrf_parameter`` and change
127-
the token ID by setting ``intention`` in your configuration:
131+
the token ID by setting ``csrf_token_id`` in your configuration:
128132

129133
.. configuration-block::
130134

@@ -140,7 +144,7 @@ After this, you have protected your login form against CSRF attacks.
140144
form_login:
141145
# ...
142146
csrf_parameter: _csrf_security_token
143-
intention: a_private_string
147+
csrf_token_id: a_private_string
144148
145149
.. code-block:: xml
146150
@@ -158,7 +162,7 @@ After this, you have protected your login form against CSRF attacks.
158162
<firewall name="secured_area">
159163
<!-- ... -->
160164
<form-login csrf-parameter="_csrf_security_token"
161-
intention="a_private_string"
165+
csrf-token-id="a_private_string"
162166
/>
163167
</firewall>
164168
</config>
@@ -176,11 +180,15 @@ After this, you have protected your login form against CSRF attacks.
176180
'form_login' => array(
177181
// ...
178182
'csrf_parameter' => '_csrf_security_token',
179-
'intention' => 'a_private_string',
183+
'csrf_token_id' => 'a_private_string'
180184
),
181185
),
182186
),
183187
));
184188
189+
.. versionadded:: 2.4
190+
The ``csrf_token_id`` option was introduced in Symfony 2.4. Prior, you
191+
had to use the ``intention`` option.
192+
185193
.. _`Cross-site request forgery`: https://en.wikipedia.org/wiki/Cross-site_request_forgery
186194
.. _`Forging Login Requests`: https://en.wikipedia.org/wiki/Cross-site_request_forgery#Forging_login_requests

Diff for: cookbook/security/guard-authentication.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ Each authenticator needs the following methods:
418418
object that should be sent to the client. The ``$exception`` will tell you
419419
*what* went wrong during authentication.
420420

421-
**start**
421+
**start(Request $request, AuthenticationException $authException = null)**
422422
This is called if the client accesses a URI/resource that requires authentication,
423423
but no authentication details were sent (i.e. you returned ``null`` from
424424
``getCredentials()``). Your job is to return a

Diff for: reference/configuration/security.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ Each part will be explained in the next section.
161161
password_parameter: _password
162162
163163
# csrf token options
164-
csrf_parameter: _csrf_token
165-
intention: authenticate
166-
csrf_provider: my.csrf_provider.id
164+
csrf_parameter: _csrf_token
165+
csrf_token_id: authenticate
166+
csrf_token_generator: my.csrf_token_generator.id
167167
168168
# by default, the login form *must* be a POST, not a GET
169169
post_only: true
@@ -209,8 +209,8 @@ Each part will be explained in the next section.
209209
context: ~
210210
logout:
211211
csrf_parameter: _csrf_token
212-
csrf_provider: ~
213-
intention: logout
212+
csrf_token_generator: ~
213+
csrf_token_id: logout
214214
path: /logout
215215
target: /
216216
success_handler: ~

0 commit comments

Comments
 (0)