@@ -41,6 +41,7 @@ class FOSUserExtension extends Extension
41
41
);
42
42
43
43
private $ mailerNeeded = false ;
44
+ private $ sessionNeeded = false ;
44
45
45
46
/**
46
47
* {@inheritdoc}
@@ -78,6 +79,7 @@ public function load(array $configs, ContainerBuilder $container)
78
79
}
79
80
80
81
if ($ config ['use_flash_notifications ' ]) {
82
+ $ this ->sessionNeeded = true ;
81
83
$ loader ->load ('flash_notifications.xml ' );
82
84
}
83
85
@@ -130,6 +132,11 @@ public function load(array $configs, ContainerBuilder $container)
130
132
if ($ this ->mailerNeeded ) {
131
133
$ container ->setAlias ('fos_user.mailer ' , $ config ['service ' ]['mailer ' ]);
132
134
}
135
+
136
+ if ($ this ->sessionNeeded ) {
137
+ // Use a private alias rather than a parameter, to avoid leaking it at runtime (the private alias will be removed)
138
+ $ container ->setAlias ('fos_user.session ' , new Alias ('session ' , false ));
139
+ }
133
140
}
134
141
135
142
/**
@@ -203,6 +210,7 @@ private function loadProfile(array $config, ContainerBuilder $container, XmlFile
203
210
private function loadRegistration (array $ config , ContainerBuilder $ container , XmlFileLoader $ loader , array $ fromEmail )
204
211
{
205
212
$ loader ->load ('registration.xml ' );
213
+ $ this ->sessionNeeded = true ;
206
214
207
215
if ($ config ['confirmation ' ]['enabled ' ]) {
208
216
$ this ->mailerNeeded = true ;
0 commit comments