File tree Expand file tree Collapse file tree 1 file changed +22
-14
lines changed Expand file tree Collapse file tree 1 file changed +22
-14
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,8 @@ public function handle(ServerRequestInterface $request)
95
95
// end buffering if we need to throw
96
96
@ob_end_clean ();
97
97
return $ response ;
98
+ } finally {
99
+ $ this ->cleanUpSession ();
98
100
}
99
101
100
102
$ out = ob_get_clean ();
@@ -211,20 +213,6 @@ protected function mapRequest(ServerRequestInterface $psrRequest)
211
213
*/
212
214
protected function mapResponse (SymfonyResponse $ syResponse , $ stdout ='' )
213
215
{
214
- // end active session
215
- if (PHP_SESSION_ACTIVE === session_status ()) {
216
- // make sure open session are saved to the storage
217
- // in case the framework hasn't closed it correctly.
218
- session_write_close ();
219
- }
220
-
221
- // reset session_id in any case to something not valid, for next request
222
- session_id ('' );
223
-
224
- //reset $_SESSION
225
- session_unset ();
226
- unset($ _SESSION );
227
-
228
216
$ nativeHeaders = [];
229
217
230
218
foreach (headers_list () as $ header ) {
@@ -338,4 +326,24 @@ protected function normalizeAppBootstrap($appBootstrap)
338
326
}
339
327
}
340
328
}
329
+
330
+ protected function cleanUpSession ()
331
+ {
332
+ // end active session
333
+ if (PHP_SESSION_ACTIVE === session_status ()) {
334
+ // make sure open session are saved to the storage
335
+ // in case the framework hasn't closed it correctly.
336
+ try {
337
+ session_write_close ();
338
+ } catch (\ErrorException $ e ) {
339
+ }
340
+ }
341
+
342
+ // reset session_id in any case to something not valid, for next request
343
+ session_id ('' );
344
+
345
+ //reset $_SESSION
346
+ session_unset ();
347
+ unset($ _SESSION );
348
+ }
341
349
}
You can’t perform that action at this time.
0 commit comments