File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
src/Symfony/Component/HttpFoundation Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -256,7 +256,11 @@ public function getFlashes()
256256 $ return = array ();
257257 if ($ all ) {
258258 foreach ($ all as $ name => $ array ) {
259- $ return [$ name ] = reset ($ array );
259+ if (is_numeric (key ($ array ))) {
260+ $ return [$ name ] = reset ($ array );
261+ } else {
262+ $ return [$ name ] = $ array ;
263+ }
260264 }
261265 }
262266
Original file line number Diff line number Diff line change @@ -183,6 +183,21 @@ public function testGetSetFlashes()
183183 $ this ->assertEquals (array ('notice ' => 'foo ' ), $ this ->session ->getFlashes ());
184184 }
185185
186+ public function testGetFlashesWithArray ()
187+ {
188+ $ array = array ('notice ' => 'hello ' , 'error ' => 'none ' );
189+ $ this ->assertEquals (array (), $ this ->session ->getFlashes ());
190+ $ this ->session ->setFlash ('foo ' , $ array );
191+ $ this ->assertEquals (array ('foo ' => $ array ), $ this ->session ->getFlashes ());
192+ $ this ->assertEquals (array (), $ this ->session ->getFlashes ());
193+
194+ $ array = array ('hello ' , 'foo ' );
195+ $ this ->assertEquals (array (), $ this ->session ->getFlashes ());
196+ $ this ->session ->setFlash ('foo ' , $ array );
197+ $ this ->assertEquals (array ('foo ' => 'hello ' ), $ this ->session ->getFlashes ());
198+ $ this ->assertEquals (array (), $ this ->session ->getFlashes ());
199+ }
200+
186201 public function testGetSetFlash ()
187202 {
188203 $ this ->assertNull ($ this ->session ->getFlash ('notice ' ));
You can’t perform that action at this time.
0 commit comments