Skip to content

Commit 9f76fdd

Browse files
committed
Merge remote-tracking branch 'origin/1.3' into update-from-1.3
Conflicts: DependencyInjection/Configuration.php EventListener/UserContextSubscriber.php
2 parents fe79d84 + 68bada0 commit 9f76fdd

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

Resources/doc/features/symfony-http-cache.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,26 @@ To register subscribers that you need to instantiate yourself, overwrite
7676
return $subscribers;
7777
}
7878

79+
.. warning::
80+
81+
Since Symfony 2.8, the class cache (``classes.php``) is compiled even in
82+
console mode by an optional warmer (``ClassCacheCacheWarmer``). This can
83+
produce conflicting results with the regular web entry points, because the
84+
class cache may contain definitions (such as the subscribers above) that
85+
are loaded before the class cache itself; leading to redeclaration fatal
86+
errors.
87+
88+
There are two workarounds:
89+
90+
* Disable class cache warming in console mode with e.g. a compiler pass::
91+
92+
$container->getDefinition('kernel.class_cache.cache_warmer')->clearTag('kernel.cache_warmer');
93+
94+
* Force loading of all classes and interfaced used by the ``HttpCache`` in
95+
``app/console`` to make the class cache omit those classes. The simplest
96+
way to achieve this is to call ``class_exists`` resp. ``interface_exists``
97+
with each of them.
98+
7999
Subscribers
80100
~~~~~~~~~~~
81101

Resources/doc/features/user-context.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ You need to configure a route for the context hash. It does not specify any
4949
controller, as the request listener will abort the request right after the
5050
firewall has been applied, but the route definition must exist. Use the same
5151
path as you specified in the caching proxy and make sure that this path is
52-
covered by your
52+
allowed for anonymous users and covered by your
5353
`firewall configuration <http://symfony.com/doc/current/book/security.html>`_:
5454

5555
.. code-block:: yaml
@@ -58,6 +58,17 @@ covered by your
5858
user_context_hash:
5959
path: /_fos_user_context_hash
6060
61+
If your access rules limit the whole site to logged in users, make sure to
62+
handle the user context URL like the login page:
63+
64+
.. code-block:: yaml
65+
66+
# app/config/security.yml
67+
access_control:
68+
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
69+
- { path: ^/_fos_user_context_hash, roles: [IS_AUTHENTICATED_ANONYMOUSLY] }
70+
- { path: ^/, roles: ROLE_USER }
71+
6172
Finally, enable the subscriber with the default settings:
6273

6374
.. code-block:: yaml

Resources/doc/spelling_word_list.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ lookup
1414
lookups
1515
TTL
1616
multi
17+
login
1718
logout

0 commit comments

Comments
 (0)