File tree 3 files changed +25
-2
lines changed
src/Symfony/Component/HttpFoundation
3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,9 @@ public function getId()
178
178
*/
179
179
public function setId ($ id )
180
180
{
181
- $ this ->storage ->setId ($ id );
181
+ if ($ this ->storage ->getId () !== $ id ) {
182
+ $ this ->storage ->setId ($ id );
183
+ }
182
184
}
183
185
184
186
/**
Original file line number Diff line number Diff line change @@ -70,6 +70,27 @@ public function testSetId()
70
70
$ this ->assertEquals ('0123456789abcdef ' , $ this ->session ->getId ());
71
71
}
72
72
73
+ public function testSetIdAfterStart ()
74
+ {
75
+ $ this ->session ->start ();
76
+ $ id = $ this ->session ->getId ();
77
+
78
+ $ e = null ;
79
+ try {
80
+ $ this ->session ->setId ($ id );
81
+ } catch (\Exception $ e ) {
82
+ }
83
+
84
+ $ this ->assertNull ($ e );
85
+
86
+ try {
87
+ $ this ->session ->setId ('different ' );
88
+ } catch (\Exception $ e ) {
89
+ }
90
+
91
+ $ this ->assertInstanceOf ('\LogicException ' , $ e );
92
+ }
93
+
73
94
public function testSetName ()
74
95
{
75
96
$ this ->assertEquals ('MOCKSESSID ' , $ this ->session ->getName ());
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ protected function setUp()
48
48
$ this ->data = array (
49
49
$ this ->attributes ->getStorageKey () => array ('foo ' => 'bar ' ),
50
50
$ this ->flashes ->getStorageKey () => array ('notice ' => 'hello ' ),
51
- );
51
+ );
52
52
53
53
$ this ->storage = new MockArraySessionStorage ();
54
54
$ this ->storage ->registerBag ($ this ->flashes );
You can’t perform that action at this time.
0 commit comments