Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2606c48

Browse filesBrowse files
committed
bug #22138 [HttpFoundation][bugfix] $bags should always be initialized (MacDada)
This PR was squashed before being merged into the 2.7 branch (closes #22138). Discussion ---------- [HttpFoundation][bugfix] $bags should always be initialized | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #21990 | License | MIT Commits ------- d984c73 [HttpFoundation][bugfix] should always be initialized
2 parents 80af083 + d984c73 commit 2606c48
Copy full SHA for 2606c48

File tree

2 files changed

+25
-1
lines changed
Filter options

2 files changed

+25
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,30 @@ public function testGetId()
9797
$this->assertNotEquals('', $this->storage->getId());
9898
}
9999

100+
public function testClearClearsBags()
101+
{
102+
$this->storage->clear();
103+
104+
$this->assertSame(array(), $this->storage->getBag('attributes')->all());
105+
$this->assertSame(array(), $this->storage->getBag('flashes')->peekAll());
106+
}
107+
108+
public function testClearStartsSession()
109+
{
110+
$this->storage->clear();
111+
112+
$this->assertTrue($this->storage->isStarted());
113+
}
114+
115+
public function testClearWithNoBagsStartsSession()
116+
{
117+
$storage = new MockArraySessionStorage();
118+
119+
$storage->clear();
120+
121+
$this->assertTrue($storage->isStarted());
122+
}
123+
100124
/**
101125
* @expectedException \RuntimeException
102126
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.