File tree 7 files changed +29
-309
lines changed 7 files changed +29
-309
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 17
17
<argument type =" service" id =" session.flash_bag" />
18
18
</service >
19
19
20
- <service id =" disableable_session" class =" Symfony\Component\HttpFoundation\Session\DisableableSessionProxy" decorates =" session" >
21
- <argument type =" service" id =" disableable_session.inner" />
22
- </service >
23
-
24
20
<service id =" Symfony\Component\HttpFoundation\Session\SessionInterface" alias =" session" />
25
21
<service id =" Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface" alias =" session.storage" />
26
22
<service id =" SessionHandlerInterface" alias =" session.handler" />
73
69
</argument >
74
70
</service >
75
71
76
- <service id =" session.disable_listener" class =" Symfony\Bundle\FrameworkBundle\EventListener\DisableSessionSubscriber" >
77
- <tag name =" kernel.event_subscriber" />
78
- <argument type =" service" id =" session" />
79
- </service >
80
-
81
72
<!-- for BC -->
82
73
<service id =" session.storage.filesystem" alias =" session.storage.mock_file" />
83
74
</services >
Original file line number Diff line number Diff line change 13
13
14
14
use Symfony \Component \HttpFoundation \Exception \ConflictingHeadersException ;
15
15
use Symfony \Component \HttpFoundation \Exception \SuspiciousOperationException ;
16
- use Symfony \Component \HttpFoundation \Session \DisableableSessionProxy ;
17
16
use Symfony \Component \HttpFoundation \Session \SessionInterface ;
18
17
19
18
/**
@@ -750,14 +749,14 @@ public function hasPreviousSession()
750
749
* like whether the session is started or not. It is just a way to check if this Request
751
750
* is associated with a Session instance.
752
751
*
753
- * @return bool true when the Request contains an enabled Session object, false otherwise
752
+ * @return bool true when the Request contains a Session object, false otherwise
754
753
*/
755
754
public function hasSession ()
756
755
{
757
- return null !== $ this ->session && !( $ this -> session instanceof DisableableSessionProxy && $ this -> session -> isDisabled ()) ;
756
+ return null !== $ this ->session ;
758
757
}
759
758
760
- public function setSession (? SessionInterface $ session )
759
+ public function setSession (SessionInterface $ session )
761
760
{
762
761
$ this ->session = $ session ;
763
762
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 18
18
use Symfony \Component \HttpKernel \Event \FinishRequestEvent ;
19
19
use Symfony \Component \HttpKernel \Event \RequestEvent ;
20
20
use Symfony \Component \HttpKernel \Event \ResponseEvent ;
21
+ use Symfony \Component \HttpKernel \Exception \UnexpectedSessionUsageException ;
21
22
use Symfony \Component \HttpKernel \KernelEvents ;
22
23
23
24
/**
@@ -83,6 +84,10 @@ public function onKernelResponse(ResponseEvent $event)
83
84
}
84
85
85
86
if ($ session instanceof Session ? $ session ->getUsageIndex () !== end ($ this ->sessionUsageStack ) : $ session ->isStarted ()) {
87
+ if (true === $ event ->getRequest ()->attributes ->get ('_stateless ' , false )) {
88
+ throw new UnexpectedSessionUsageException ();
89
+ }
90
+
86
91
if ($ autoCacheControl ) {
87
92
$ response
88
93
->setExpires (new \DateTime ())
Original file line number Diff line number Diff line change 12
12
namespace Symfony \Component \HttpKernel \EventListener ;
13
13
14
14
use Psr \Container \ContainerInterface ;
15
- use Symfony \Component \HttpFoundation \Session \DisableableSessionProxy ;
16
15
use Symfony \Component \HttpFoundation \Session \SessionInterface ;
17
16
use Symfony \Component \HttpFoundation \Session \Storage \NativeSessionStorage ;
18
17
@@ -40,11 +39,6 @@ protected function getSession(): ?SessionInterface
40
39
return null ;
41
40
}
42
41
43
- $ session = $ this ->container ->get ('session ' );
44
- if ($ session instanceof DisableableSessionProxy && $ session ->isDisabled ()) {
45
- return null ;
46
- }
47
-
48
42
if ($ this ->container ->has ('session_storage ' )
49
43
&& ($ storage = $ this ->container ->get ('session_storage ' )) instanceof NativeSessionStorage
50
44
&& ($ masterRequest = $ this ->container ->get ('request_stack ' )->getMasterRequest ())
@@ -53,6 +47,6 @@ protected function getSession(): ?SessionInterface
53
47
$ storage ->setOptions (['cookie_secure ' => true ]);
54
48
}
55
49
56
- return $ session ;
50
+ return $ this -> container -> get ( ' session ' ) ;
57
51
}
58
52
}
You can’t perform that action at this time.
0 commit comments