File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed
DependencyInjection/Compiler Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 11Changelog
22=========
33
4+ 1.3.15
5+ ------
6+
7+ * Fix session_listener decoration when session is not enabled.
8+
491.3.14
510------
611
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of the FOSHttpCacheBundle package.
5+ *
6+ * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ */
11+
12+ namespace FOS \HttpCacheBundle \DependencyInjection \Compiler ;
13+
14+ use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
15+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
16+
17+ /**
18+ * Remove the session listener decorator again if the application has no session listener.
19+ *
20+ * This will happen on some APIs when the session system is not activated.
21+ */
22+ class SessionListenerRemovePass implements CompilerPassInterface
23+ {
24+ /**
25+ * {@inheritdoc}
26+ */
27+ public function process (ContainerBuilder $ container )
28+ {
29+ if ($ container ->has ('session_listener ' )) {
30+ return ;
31+ }
32+
33+ $ container ->removeDefinition ('fos_http_cache.user_context.session_listener ' );
34+ }
35+ }
Original file line number Diff line number Diff line change 1515use FOS \HttpCacheBundle \DependencyInjection \Compiler \SecurityContextPass ;
1616use FOS \HttpCacheBundle \DependencyInjection \Compiler \TagSubscriberPass ;
1717use FOS \HttpCacheBundle \DependencyInjection \Compiler \HashGeneratorPass ;
18+ use FOS \HttpCacheBundle \DependencyInjection \Compiler \SessionListenerRemovePass ;
1819use Symfony \Component \DependencyInjection \ContainerBuilder ;
1920use Symfony \Component \HttpKernel \Bundle \Bundle ;
21+ use Symfony \Component \HttpKernel \Kernel ;
2022
2123class FOSHttpCacheBundle extends Bundle
2224{
@@ -29,5 +31,8 @@ public function build(ContainerBuilder $container)
2931 $ container ->addCompilerPass (new SecurityContextPass ());
3032 $ container ->addCompilerPass (new TagSubscriberPass ());
3133 $ container ->addCompilerPass (new HashGeneratorPass ());
34+ if (version_compare (Kernel::VERSION , '3.4 ' , '>= ' )) {
35+ $ container ->addCompilerPass (new SessionListenerRemovePass ());
36+ }
3237 }
3338}
You can’t perform that action at this time.
0 commit comments