8000 MockArraySessionStorage: bugfix: $bags should be always initialized · symfony/symfony@f1a1068 · GitHub
[go: up one dir, main page]

Skip to content

Commit f1a1068

Browse files
committed
MockArraySessionStorage: bugfix: $bags should be always initialized
#21990
1 parent 44f67af commit f1a1068

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class MockArraySessionStorage implements SessionStorageInterface
6060
/**
6161
* @var array
6262
*/
63-
protected $bags;
63+
protected $bags = array();
6464

6565
/**
6666
* Constructor.

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ public function testClearStartsSession()
112112
$this->assertTrue($this->storage->isStarted());
113113
}
114114

115+
public function testClearWithNoBagsStartsSession()
116+
{
117+
$storage = new MockArraySessionStorage();
118+
119+
$storage->clear();
120+
121+
$this->assertTrue($storage->isStarted());
122+
}
123+
115124
/**
116125
* @expectedException \RuntimeException
117126
*/

0 commit comments

Comments
 (0)
0