8000 bug #25182 [HttpFoundation] AutExpireFlashBag should not clear new fl… · symfony/symfony@e2c608a · GitHub
[go: up one dir, main page]

Skip to content

Commit e2c608a

Browse files
committed
bug #25182 [HttpFoundation] AutExpireFlashBag should not clear new flashes (Simperfit, sroze)
This PR was merged into the 2.7 branch. Discussion ---------- [HttpFoundation] AutExpireFlashBag should not clear new flashes | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | #9318 | License | MIT | Doc PR | none I feel like very happy ! :) But don't worry I'm. ![img_2826](https://user-images.githubusercontent.com/3451634/33304006-99d44f38-d406-11e7-93f2-4dbc19891299.jpg) Commits ------- 706201e Test that it do not remove the new flashes when displaying the existing ones 7fe3fe8 [HttpFoundation] AutExpireFlashBag should not clear new flashes
2 parents e3e239f + 706201e commit e2c608a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function get($type, array $default = array())
106106
public function all()
107107
{
108108
$return = $this->flashes['display'];
109-
$this->flashes = array('new' => array(), 'display' => array());
109+
$this->flashes['display'] = array();
110110

111111
return $return;
112112
}

src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,12 @@ public function testClear()
150150
{
151151
$this->assertEquals(array('notice' => array('A previous flash message')), $this->bag->clear());
152152
}
153+
154+
public function testDoNotRemoveTheNewFlashesWhenDisplayingTheExistingOnes()
155+
{
156+
$this->bag->add('success', 'Something');
157+
$this->bag->all();
158+
159+
$this->assertEquals(array('new' => array('success' => array('Something')), 'display' => array()), $this->array);
160+
}
153161
}

0 commit comments

Comments
 (0)
0