Skip to content

Commit 7f5a99f

Browse files
committed
Merge branch '3.4' into 4.0
* 3.4: Update the documentation for Symfony Flex Improved the multiple user providers article Removed a no longer relevant text Update NotBlank constraint description add missing argument binding section Added a minor note about Composer's plaform config Update 3.3-di-changes.rst added initial_place entry added initial_place entry [FrameworkBundle] add documentation request context in Asset for use in console commands Update choice_attr.rst.inc
2 parents f226072 + 0e66933 commit 7f5a99f

File tree

10 files changed

+67
-51
lines changed

10 files changed

+67
-51
lines changed

console/request_context.rst

+11-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Configuring the Request Context Globally
2121

2222
To configure the Request Context - which is used by the URL Generator - you can
2323
redefine the parameters it uses as default values to change the default host
24-
(``localhost``) and scheme (``http``). You can also configure the base path if
25-
Symfony is not running in the root directory.
24+
(``localhost``) and scheme (``http``). You can also configure the base path (both for
25+
the URL generator and the assets) if Symfony is not running in the root directory.
2626

2727
Note that this does not impact URLs generated via normal web requests, since those
2828
will override the defaults.
@@ -36,6 +36,8 @@ will override the defaults.
3636
router.request_context.host: example.org
3737
router.request_context.scheme: https
3838
router.request_context.base_url: my/path
39+
asset.request_context.base_path: %router.request_context.base_url%
40+
asset.request_context.secure: true
3941
4042
.. code-block:: xml
4143
@@ -48,6 +50,8 @@ will override the defaults.
4850
<parameter key="router.request_context.host">example.org</parameter>
4951
<parameter key="router.request_context.scheme">https</parameter>
5052
<parameter key="router.request_context.base_url">my/path</parameter>
53+
<parameter key="asset.request_context.base_path">%router.request_context.base_url%</parameter>
54+
<parameter key="asset.request_context.secure">true</parameter>
5155
</parameters>
5256
5357
</container>
@@ -58,6 +62,11 @@ will override the defaults.
5862
$container->setParameter('router.request_context.host', 'example.org');
5963
$container->setParameter('router.request_context.scheme', 'https');
6064
$container->setParameter('router.request_context.base_url', 'my/path');
65+
$container->setParameter('asset.request_context.base_path', $container->getParameter('router.request_context.base_url'));
66+
$container->setParameter('asset.request_context.secure', true);
67+
68+
.. versionadded:: 3.4
69+
The ``asset.request_context.*`` parameters were introduced in Symfony 3.4.
6170

6271
Configuring the Request Context per Command
6372
-------------------------------------------

contributing/code/security.rst

+4-39
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ confirmed, the core team works on a solution following these steps:
3737
#. Package new versions for all affected versions;
3838
#. Publish the post on the official Symfony `blog`_ (it must also be added to
3939
the "`Security Advisories`_" category);
40-
#. Update the security advisory list (see below).
4140
#. Update the public `security advisories database`_ maintained by the
4241
FriendsOfPHP organization and which is used by the ``security:check`` command.
4342

@@ -100,47 +99,13 @@ Security Advisories
10099
You can check your Symfony application for known security vulnerabilities
101100
using the ``security:check`` command (see :doc:`/security/security_checker`).
102101

103-
This section indexes security vulnerabilities that were fixed in Symfony
104-
releases, starting from Symfony 1.0.0:
105-
106-
* Jul 17, 2017, `CVE-2017-11365: Empty passwords validation issue <https://symfony.com/blog/cve-2017-11365-empty-passwords-validation-issue>`_ (2.7.30, 2.7.31, 2.8.23, 2.8.24, 3.2.10, 3.2.11, 3.3.3, and 3.3.4)
107-
* May 9, 2016: `CVE-2016-2403: Unauthorized access on a misconfigured Ldap server when using an empty password <https://symfony.com/blog/cve-2016-2403-unauthorized-access-on-a-misconfigured-ldap-server-when-using-an-empty-password>`_ (2.8.0-2.8.5, 3.0.0-3.0.5)
108-
* May 9, 2016: `CVE-2016-4423: Large username storage in session <https://symfony.com/blog/cve-2016-4423-large-username-storage-in-session>`_ (2.3.0-2.3.40, 2.7.0-2.7.12, 2.8.0-2.8.5, 3.0.0-3.0.5)
109-
* January 18, 2016: `CVE-2016-1902: SecureRandom's fallback not secure when OpenSSL fails <https://symfony.com/blog/cve-2016-1902-securerandom-s-fallback-not-secure-when-openssl-fails>`_ (2.3.0-2.3.36, 2.6.0-2.6.12, 2.7.0-2.7.8)
110-
* November 23, 2015: `CVE-2015-8125: Potential Remote Timing Attack Vulnerability in Security Remember-Me Service <https://symfony.com/blog/cve-2015-8125-potential-remote-timing-attack-vulnerability-in-security-remember-me-service>`_ (2.3.35, 2.6.12 and 2.7.7)
111-
* November 23, 2015: `CVE-2015-8124: Session Fixation in the "Remember Me" Login Feature <https://symfony.com/blog/cve-2015-8124-session-fixation-in-the-remember-me-login-feature>`_ (2.3.35, 2.6.12 and 2.7.7)
112-
* May 26, 2015: `CVE-2015-4050: ESI unauthorized access <https://symfony.com/blog/cve-2015-4050-esi-unauthorized-access>`_ (Symfony 2.3.29, 2.5.12 and 2.6.8)
113-
* April 1, 2015: `CVE-2015-2309: Unsafe methods in the Request class <https://symfony.com/blog/cve-2015-2309-unsafe-methods-in-the-request-class>`_ (Symfony 2.3.27, 2.5.11 and 2.6.6)
114-
* April 1, 2015: `CVE-2015-2308: Esi Code Injection <https://symfony.com/blog/cve-2015-2308-esi-code-injection>`_ (Symfony 2.3.27, 2.5.11 and 2.6.6)
115-
* September 3, 2014: `CVE-2014-6072: CSRF vulnerability in the Web Profiler <https://symfony.com/blog/cve-2014-6072-csrf-vulnerability-in-the-web-profiler>`_ (Symfony 2.3.19, 2.4.9 and 2.5.4)
116-
* September 3, 2014: `CVE-2014-6061: Security issue when parsing the Authorization header <https://symfony.com/blog/cve-2014-6061-security-issue-when-parsing-the-authorization-header>`_ (Symfony 2.3.19, 2.4.9 and 2.5.4)
117-
* September 3, 2014: `CVE-2014-5245: Direct access of ESI URLs behind a trusted proxy <https://symfony.com/blog/cve-2014-5245-direct-access-of-esi-urls-behind-a-trusted-proxy>`_ (Symfony 2.3.19, 2.4.9 and 2.5.4)
118-
* September 3, 2014: `CVE-2014-5244: Denial of service with a malicious HTTP Host header <https://symfony.com/blog/cve-2014-5244-denial-of-service-with-a-malicious-http-host-header>`_ (Symfony 2.3.19, 2.4.9 and 2.5.4)
119-
* July 15, 2014: `Security releases: Symfony 2.3.18, 2.4.8, and 2.5.2 released <https://symfony.com/blog/security-releases-cve-2014-4931-symfony-2-3-18-2-4-8-and-2-5-2-released>`_ (`CVE-2014-4931 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-4931>`_)
120-
* October 10, 2013: `Security releases: Symfony 2.0.25, 2.1.13, 2.2.9, and 2.3.6 released <https://symfony.com/blog/security-releases-cve-2013-5958-symfony-2-0-25-2-1-13-2-2-9-and-2-3-6-released>`_ (`CVE-2013-5958 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-5958>`_)
121-
* August 7, 2013: `Security releases: Symfony 2.0.24, 2.1.12, 2.2.5, and 2.3.3 released <https://symfony.com/blog/security-releases-symfony-2-0-24-2-1-12-2-2-5-and-2-3-3-released>`_ (`CVE-2013-4751 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-4751>`_ and `CVE-2013-4752 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-4752>`_)
122-
* January 17, 2013: `Security release: Symfony 2.0.22 and 2.1.7 released <https://symfony.com/blog/security-release-symfony-2-0-22-and-2-1-7-released>`_ (`CVE-2013-1348 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-1348>`_ and `CVE-2013-1397 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-1397>`_)
123-
* December 20, 2012: `Security release: Symfony 2.0.20 and 2.1.5 <https://symfony.com/blog/security-release-symfony-2-0-20-and-2-1-5-released>`_ (`CVE-2012-6431 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-6431>`_ and `CVE-2012-6432 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-6432>`_)
124-
* November 29, 2012: `Security release: Symfony 2.0.19 and 2.1.4 <https://symfony.com/blog/security-release-symfony-2-0-19-and-2-1-4>`_
125-
* November 25, 2012: `Security release: symfony 1.4.20 released <https://symfony.com/blog/security-release-symfony-1-4-20-released>`_ (`CVE-2012-5574 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-5574>`_)
126-
* August 28, 2012: `Security Release: Symfony 2.0.17 released <https://symfony.com/blog/security-release-symfony-2-0-17-released>`_
127-
* May 30, 2012: `Security Release: symfony 1.4.18 released <https://symfony.com/blog/security-release-symfony-1-4-18-released>`_ (`CVE-2012-2667 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-2667>`_)
128-
* February 24, 2012: `Security Release: Symfony 2.0.11 released <https://symfony.com/blog/security-release-symfony-2-0-11-released>`_
129-
* November 16, 2011: `Security Release: Symfony 2.0.6 <https://symfony.com/blog/security-release-symfony-2-0-6>`_
130-
* March 21, 2011: `symfony 1.3.10 and 1.4.10: security releases <https://symfony.com/blog/symfony-1-3-10-and-1-4-10-security-releases>`_
131-
* June 29, 2010: `Security Release: symfony 1.3.6 and 1.4.6 <https://symfony.com/blog/security-release-symfony-1-3-6-and-1-4-6>`_
132-
* May 31, 2010: `symfony 1.3.5 and 1.4.5 <https://symfony.com/blog/symfony-1-3-5-and-1-4-5>`_
133-
* February 25, 2010: `Security Release: 1.2.12, 1.3.3 and 1.4.3 <https://symfony.com/blog/security-release-1-2-12-1-3-3-and-1-4-3>`_
134-
* February 13, 2010: `symfony 1.3.2 and 1.4.2 <https://symfony.com/blog/symfony-1-3-2-and-1-4-2>`_
135-
* April 27, 2009: `symfony 1.2.6: Security fix <https://symfony.com/blog/symfony-1-2-6-security-fix>`_
136-
* October 03, 2008: `symfony 1.1.4 released: Security fix <https://symfony.com/blog/symfony-1-1-4-released-security-fix>`_
137-
* May 14, 2008: `symfony 1.0.16 is out <https://symfony.com/blog/symfony-1-0-16-is-out>`_
138-
* April 01, 2008: `symfony 1.0.13 is out <https://symfony.com/blog/symfony-1-0-13-is-out>`_
139-
* March 21, 2008: `symfony 1.0.12 is (finally) out ! <https://symfony.com/blog/symfony-1-0-12-is-finally-out>`_
140-
* June 25, 2007: `symfony 1.0.5 released (security fix) <https://symfony.com/blog/symfony-1-0-5-released-security-fix>`_
102+
Check the `Security Advisories`_ blog category for a list of all security
103+
vulnerabilities that were fixed in Symfony releases, starting from Symfony
104+
1.0.0.
141105

142106
.. _Git repository: https://github.com/symfony/symfony
143107
.. _blog: https://symfony.com/blog/
144108
.. _Security Advisories: https://symfony.com/blog/category/security-advisories
145109
.. _`security advisories database`: https://github.com/FriendsOfPHP/security-advisories
146110
.. _`mitre.org`: https://cveform.mitre.org/
111+
.. _`Security Advisories`: https://symfony.com/blog/category/security-advisories

reference/constraints/NotBlank.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ NotBlank
22
========
33

44
Validates that a value is not blank - meaning not equal to a blank string,
5-
a blank array or ``null``::
5+
a blank array, ``null`` or ``false``::
66

77
if (false === $value || (empty($value) && '0' != $value)) {
88
// validation will fail

reference/forms/types/options/choice_attr.rst.inc

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ choice_attr
33

44
**type**: ``array``, ``callable`` or ``string`` **default**: ``array()``
55

6-
Use this to add additional HTML attributes to each choice. This can be an array
7-
of attributes (if they are the same for each choice), a callable or a property path
6+
Use this to add additional HTML attributes to each choice. This can be
7+
an associative array where the keys match the choice keys and the values
8+
are the attributes for each choice, a callable or a property path
89
(just like `choice_label`_).
910

1011
If an array, the keys of the ``choices`` array must be used as keys::

security/multiple_user_providers.rst

+26
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
How to Use multiple User Providers
22
==================================
33

4+
.. note::
5+
6+
It's always better to use a specific user provider for each authentication
7+
mechanism. Chaining user providers should be avoided in most applications
8+
and used only to solve edge cases.
9+
410
Each authentication mechanism (e.g. HTTP Authentication, form login, etc.) uses
511
exactly one user provider. But what if you want to specify a few users via
612
configuration and the rest of your users in the database? This is possible by
@@ -147,5 +153,25 @@ authentication system will use the ``in_memory`` user provider. But if the user
147153
tries to log in via the form login, the ``user_db`` provider will be used (since
148154
it's the default for the firewall as a whole).
149155

156+
If you need to check that the user being returned by your provider is a allowed
157+
to authenticate, check the returned user object::
158+
159+
use Symfony\Component\Security\Core\User;
160+
// ...
161+
162+
public function loadUserByUsername($username)
163+
{
164+
// ...
165+
166+
// you can, for example, test that the returned user is an object of a
167+
// particular class or check for certain attributes of your user objects
168+
if ($user instance User) {
169+
// the user was loaded from the main security config file. Do something.
170+
// ...
171+
}
172+
173+
return $user;
174+
}
175+
150176
For more information about user provider and firewall configuration, see
151177
the :doc:`/reference/configuration/security`.

service_container/3.3-di-changes.rst

+10
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,16 @@ Start by updating the service ids to class names:
568568
  you can't redefine the service as ``Twig_Extensions_Extension_Intl: ~`` and
569569
you must keep the original ``class`` parameter.
570570

571+
.. caution::
572+
573+
If a service is processed by a :doc:`compiler pass </service_container/compiler_passes>`,
574+
you could face a "You have requested a non-existent service" error.
575+
To get rid of this, be sure that the Compiler Pass is using ``findDefinition()``
576+
instead of ``getDefinition()``. The latter won't take aliases into
577+
account when looking up for services.
578+
Furthermore it is always recommended to check for definition existence
579+
using ``has()`` function.
580+
571581
But, this change will break our app! The old service ids (e.g. ``app.github_notifier``)
572582
no longer exist. The simplest way to fix this is to find all your old service ids
573583
and update them to the new class id: ``app.github_notifier`` to ``App\Service\GitHubNotifier``.

setup/_update_dep_errors.rst.inc

+8
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@ the issue.
1919
2020
Or, you may have deeper issues where different libraries depend on conflicting
2121
versions of other libraries. Check your error message to debug.
22+
23+
Another issue that may happen is that the project dependencies can be installed
24+
in your local computer but not on the remote server. This usually happens when
25+
the PHP versions are different on each machine. The solution is to add the
26+
`platform`_ config option in your `composer.json` file to define the highest
27+
PHP version allowed for the dependencies (set it to server's PHP version).
28+
29+
.. _`platform`: https://getcomposer.org/doc/06-config.md#platform

setup/flex.rst

+2-7
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,8 @@ two public repositories:
9595

9696
* `Contrib recipe repository`_, contains all the recipes created by the
9797
community. All of them are guaranteed to work, but their associated packages
98-
could be unmaintained. Symfony Flex ignores these recipes by default, but you
99-
can execute this command to start using them in your project:
100-
101-
.. code-block:: terminal
102-
103-
$ cd your-project/
104-
$ composer config extra.symfony.allow-contrib true
98+
could be unmaintained. Symfony Flex will ask your permission before installing
99+
any of these recipes.
105100

106101
Read the `Symfony Recipes documentation`_ to learn everything about how to
107102
create recipes for your own packages.

workflow/state-machines.rst

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Below is the configuration for the pull request state machine.
3535
type: 'state_machine'
3636
supports:
3737
- App\Entity\PullRequest
38+
initial_place: start
3839
places:
3940
- start
4041
- coding

workflow/usage.rst

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ like this:
4646
- 'currentPlace'
4747
supports:
4848
- App\Entity\BlogPost
49+
initial_place: draft
4950
places:
5051
- draft
5152
- review

0 commit comments

Comments
 (0)