File tree Expand file tree Collapse file tree 3 files changed +49
-0
lines changed
DependencyInjection/Compiler Expand file tree Collapse file tree 3 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 1
1
Changelog
2
2
=========
3
3
4
+ 2.2.2
5
+ -----
6
+
7
+ ### Fixed
8
+
9
+ * Fix session_listener decoration when session is not enabled.
10
+
4
11
2.2.1
5
12
-----
6
13
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 13
13
14
14
use FOS \HttpCacheBundle \DependencyInjection \Compiler \HashGeneratorPass ;
15
15
use FOS \HttpCacheBundle \DependencyInjection \Compiler \LoggerPass ;
16
+ use FOS \HttpCacheBundle \DependencyInjection \Compiler \SessionListenerRemovePass ;
16
17
use FOS \HttpCacheBundle \DependencyInjection \Compiler \TagListenerPass ;
17
18
use Symfony \Component \Console \Application ;
18
19
use Symfony \Component \DependencyInjection \ContainerBuilder ;
19
20
use Symfony \Component \HttpKernel \Bundle \Bundle ;
21
+ use Symfony \Component \HttpKernel \Kernel ;
20
22
21
23
class FOSHttpCacheBundle extends Bundle
22
24
{
@@ -28,6 +30,11 @@ public function build(ContainerBuilder $container)
28
30
$ container ->addCompilerPass (new LoggerPass ());
29
31
$ container ->addCompilerPass (new TagListenerPass ());
30
32
$ container ->addCompilerPass (new HashGeneratorPass ());
33
+ if (version_compare (Kernel::VERSION , '3.4 ' , '>= ' )
34
+ && version_compare (Kernel::VERSION , '4.1 ' , '< ' )
35
+ ) {
36
+ $ container ->addCompilerPass (new SessionListenerRemovePass ());
37
+ }
31
38
}
32
39
33
40
public function registerCommands (Application $ application )
You can’t perform that action at this time.
0 commit comments